/**
 * Reconnect app — Mobile-only, full-width. Tinder/Bumble-style, romance theme.
 * Optimized for phone: safe areas, touch targets, no horizontal scroll.
 */
* { box-sizing: border-box; }
html {
    width: 100%;
    height: 100%;
    height: 100dvh;
    overflow-x: hidden;
    overflow-y: hidden;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}
:root {
    --primary: #e91e63;
    --primary-dark: #c2185b;
    --primary-light: #f8bbd9;
    --accent: #ff4081;
    --bg: rgba(248, 247, 251, 0.72);
    --surface: #fff;
    --text: #16161f;
    --text-muted: #64748b;
    --border: #e8e6ed;
    --match-bg: linear-gradient(135deg, #e91e63 0%, #ff4081 100%);
    --shadow: 0 8px 32px rgba(22, 22, 31, 0.06);
    --chrome-glass: rgba(255, 255, 255, 0.78);
    --chrome-glass-border: rgba(0, 0, 0, 0.06);
    --input-fill: #faf9fc;
    --nav-height: 56px;
    --footer-height: calc(2.5rem + var(--safe-bottom));
    --top-bar-height: calc(52px + max(0.5rem, var(--safe-top)));
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-left: env(safe-area-inset-left, 0px);
    --safe-right: env(safe-area-inset-right, 0px);
    --touch-min: 44px;
}
[data-theme="dark"] {
    --bg: rgba(18, 16, 24, 0.75);
    --surface: #1e1e1e;
    --text: #e8e6ed;
    --text-muted: #94a3b8;
    --border: #2d2a35;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
    --chrome-glass: rgba(28, 26, 34, 0.82);
    --chrome-glass-border: rgba(255, 255, 255, 0.06);
    --input-fill: rgba(255, 255, 255, 0.06);
}

body { margin: 0; width: 100%; height: 100%; min-height: 100vh; min-height: 100dvh; font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif; background: transparent; color: var(--text); -webkit-tap-highlight-color: transparent; overflow: hidden; line-height: 1.5; position: relative; font-size: 16px; }

/* Resilience: offline banner, error toast, chat unavailable, image fallback */
.reconnect-offline-banner { position: fixed; top: 0; left: 0; right: 0; z-index: 9999; background: #c62828; color: #fff; text-align: center; padding: 0.5rem 1rem; font-size: 0.9rem; }
.reconnect-offline-banner.hidden { display: none; }
.reconnect-offline-banner-ok { background: #2e7d32; }
.reconnect-error-toast { position: fixed; bottom: calc(var(--nav-height, 56px) + 1rem); left: 50%; transform: translateX(-50%); max-width: 90%; padding: 0.75rem 1rem; background: var(--text); color: var(--bg); border-radius: 8px; font-size: 0.9rem; z-index: 9998; box-shadow: var(--shadow); }
.reconnect-chat-unavailable { padding: 0.6rem 1rem; background: #fff3e0; border: 1px solid #ffb74d; border-radius: 8px; margin: 0.5rem 1rem; font-size: 0.9rem; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.5rem; }
.reconnect-chat-unavailable.hidden { display: none; }
.reconnect-chat-retry-btn { padding: 0.35rem 0.75rem; border: 1px solid var(--primary); background: var(--surface); color: var(--primary); border-radius: 6px; cursor: pointer; font-size: 0.9rem; }
.reconnect-chat-retry-btn:hover { background: rgba(233, 30, 99, 0.08); }
.msg-send-failed .msg-text { color: #c62828; font-style: italic; }
.msg-send-failed { cursor: pointer; }
.msg-send-failed:hover .msg-text { text-decoration: underline; }
img.reconnect-img-failed { min-height: 60px; cursor: pointer; opacity: 0.85; }
.reconnect-loading-state { padding: 1.5rem; text-align: center; color: var(--text-muted); }
.reconnect-error-state { padding: 1rem; text-align: center; color: #c62828; }
.reconnect-retry-btn { margin-top: 0.5rem; padding: 0.4rem 0.8rem; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); cursor: pointer; }
.reconnect-retry-btn:hover { border-color: var(--primary); color: var(--primary); }

/* Page / inline loaders — classic ring (your snippet) + heart variant (.loader.reconnect-heart-loader) */
@-webkit-keyframes spin {
    to { -webkit-transform: rotate(360deg); transform: rotate(360deg); }
}
@keyframes spin {
    to { transform: rotate(360deg); }
}
.loader {
    width: 60px;
    height: 60px;
    border: 8px solid #e5e7eb;
    border-top: 8px solid #3b82f6;
    border-radius: 50%;
    -webkit-animation: spin 1s linear infinite;
    animation: spin 1s linear infinite;
    margin: 50px auto;
    display: block;
    box-sizing: border-box;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}
[data-theme="dark"] .loader:not(.reconnect-heart-loader) {
    border-color: #374151;
    border-top-color: #60a5fa;
}
/* Heart: same box size, SVG (romantic accent). Animation on the span — not SVG <g> (Android WebView). */
.loader.reconnect-heart-loader,
.reconnect-heart-loader {
    border: none;
    border-radius: 0;
    -webkit-animation: none;
    animation: none;
    margin: 50px auto;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.loader.reconnect-heart-loader.reconnect-heart-loader--spin-outer,
.reconnect-heart-loader.reconnect-heart-loader--spin-outer {
    -webkit-animation: spin 1s linear infinite !important;
    animation: spin 1s linear infinite !important;
    -webkit-transform-origin: center center;
    transform-origin: center center;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    will-change: transform;
}
.reconnect-heart-loader-svg {
    width: 100%;
    height: 100%;
    display: block;
    overflow: visible;
}
.reconnect-heart-loader-track {
    stroke: #e5e7eb;
    fill: none;
}
[data-theme="dark"] .reconnect-heart-loader-track {
    stroke: #374151;
}
.reconnect-heart-loader-active {
    stroke: var(--primary);
    fill: none;
}
@media (prefers-reduced-motion: reduce) {
    .loader:not(.reconnect-heart-loader) {
        -webkit-animation-duration: 2.5s;
        animation-duration: 2.5s;
    }
    .loader.reconnect-heart-loader.reconnect-heart-loader--spin-outer,
    .reconnect-heart-loader.reconnect-heart-loader--spin-outer {
        -webkit-animation-duration: 2.5s !important;
        animation-duration: 2.5s !important;
    }
}
.reconnect-page-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2.5rem 1rem;
    gap: 0.75rem;
    text-align: center;
}
.reconnect-page-loading .loader.reconnect-heart-loader { margin: 0; }
.reconnect-page-loading .profile-view-empty { padding: 0; }

/* Per-image/video/audio shell: heart + “Loading…” until media fires load */
.reconnect-heart-loader--compact {
    width: 40px;
    height: 40px;
    margin: 0 !important;
}
.reconnect-media-shell {
    position: relative;
    display: inline-block;
    max-width: 100%;
    vertical-align: top;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}
/* Busy shells need a box on Android before intrinsic image size exists */
.reconnect-media-shell.reconnect-media-shell--busy {
    min-width: 80px;
    min-height: 88px;
}
.msg-avatar .reconnect-media-shell.reconnect-media-shell--busy {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
}
.reconnect-media-shell > img,
.reconnect-media-shell > video {
    display: block;
    max-width: 100%;
}
.reconnect-media-shell > audio {
    display: block;
    width: 100%;
    min-width: 200px;
}
.reconnect-media-shell-overlay {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    display: none;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -webkit-flex-direction: column;
    flex-direction: column;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
    -webkit-box-pack: center;
    -webkit-justify-content: center;
    justify-content: center;
    gap: 0.3rem;
    padding: 0.35rem;
    box-sizing: border-box;
    background: rgba(255, 255, 255, 0.88);
    z-index: 5;
    pointer-events: none;
    text-align: center;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    isolation: isolate;
}
[data-theme="dark"] .reconnect-media-shell-overlay {
    background: rgba(30, 30, 30, 0.88);
}
.msg .reconnect-media-shell-overlay {
    background: rgba(0, 0, 0, 0.55);
}
.msg .reconnect-media-shell-label {
    color: rgba(255, 255, 255, 0.95);
}
.msg .reconnect-heart-loader--compact .reconnect-heart-loader-track {
    stroke: rgba(255, 255, 255, 0.35);
}
.msg .reconnect-heart-loader--compact .reconnect-heart-loader-active {
    stroke: #fff;
}
.reconnect-media-shell-label {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--text-muted);
    line-height: 1.2;
    max-width: 10rem;
}
.reconnect-media-shell--busy .reconnect-media-shell-overlay {
    display: -webkit-box;
    display: flex;
}
.reconnect-media-shell--busy > img[src=""]:not(.msg-avatar-img),
.reconnect-media-shell--busy > img[src^="data:"]:not(.msg-avatar-img),
.reconnect-media-shell--busy > video:not([src]),
.reconnect-media-shell--busy > video[src=""] {
    min-height: 100px;
    min-width: 80px;
    background: var(--border);
}
.msg-avatar .reconnect-media-shell {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}
.msg-avatar .reconnect-media-shell > img {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 50%;
}
.msg-avatar .reconnect-media-shell-overlay {
    border-radius: 50%;
}
.msg-body .reconnect-media-shell {
    width: 100%;
    max-width: 100%;
}
.gallery-item .reconnect-media-shell,
.settings-media-thumb .reconnect-media-shell,
.toy-board-photo-item .reconnect-media-shell,
.partner-kink-field .reconnect-media-shell {
    max-width: 100%;
}
.explore-shared-body .reconnect-media-shell {
    width: 100%;
    max-width: 100%;
}
.explore-link-preview-thumb-wrap.reconnect-media-shell {
    display: inline-block;
}

/* PWA install banner */
.pwa-install-banner { position: fixed; bottom: calc(var(--nav-height, 56px) + var(--safe-bottom, 0px) + 0.5rem); left: 0.5rem; right: 0.5rem; z-index: 9990; background: var(--surface); border: 1px solid rgba(233, 30, 99, 0.35); border-radius: 14px; padding: 1rem; box-shadow: var(--shadow); }
.pwa-install-banner.hidden { display: none !important; }
.pwa-install-banner-text { margin: 0 0 0.75rem; font-size: 0.95rem; line-height: 1.4; }
.pwa-install-banner-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.pwa-install-banner-actions .kink-game-btn { flex: 1; min-width: 120px; }
.pwa-install-how-summary { cursor: pointer; font-size: 0.9rem; color: var(--primary); }
.pwa-install-how-list { margin: 0.5rem 0 0; padding-left: 1.25rem; }
.pwa-install-how-list li { margin: 0.35rem 0; }

.upload-progress-bar { position: fixed; top: var(--top-bar-height, 52px); left: 0; right: 0; height: 4px; background: var(--border); z-index: 9995; overflow: hidden; pointer-events: none; }
.upload-progress-bar.hidden { display: none !important; }
.upload-progress-bar-fill { height: 100%; width: 40%; background: var(--primary); animation: upload-progress-slide 1.2s ease-in-out infinite; }
@keyframes upload-progress-slide { 0% { transform: translateX(-100%); } 50% { transform: translateX(250%); } 100% { transform: translateX(-100%); } }

#app { width: 100%; height: 100%; overflow: hidden; max-width: 100vw; min-width: 0; position: relative; z-index: 1; }
#app:not(:has(#app-shell)) { overflow-y: auto; -webkit-overflow-scrolling: touch; }
#app-shell { position: fixed; inset: 0; width: 100%; max-width: 100vw; height: 100%; height: 100dvh; overflow: hidden; display: flex; flex-direction: column; }
#app-shell.hidden { display: none !important; }
.main-content { width: 100%; max-width: 100vw; min-width: 0; flex: 1; min-height: 0; overflow-x: hidden; overflow-y: auto; -webkit-overflow-scrolling: touch; pointer-events: auto; position: relative; z-index: 1; }
.panel { width: 100%; box-sizing: border-box; max-width: 100vw; min-width: 0; }
#panel-home { text-align: center; }
#panel-home #home-checkin-wrap,
#panel-home #home-mood-history { position: relative; z-index: 2; }
/* Prevent horizontal scroll: constrain tables, pre, code, long words */
.panel table { display: block; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.panel pre, .panel code { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; word-break: break-word; }
.panel input[type="text"], .panel input[type="email"], .panel input[type="url"], .panel input[type="number"], .panel textarea, .panel select { max-width: 100%; }
/* Mobile-first: remove tap delay, prevent overscroll, 44px+ touch targets, no callout on buttons */
button, a, [role="button"], .bottom-nav a, .mood-btn, .mood-btn-delete, .tap-btn, .kink-game-btn, .profile-tab,
.home-notification-bell, .app-profile-btn, .app-profile-dropdown-item, .home-notification-dropdown a,
.tag-pill, .avatar-picker-item, .rate-btn, .glossary-close, .chat-tab, .chat-send-as-btn { touch-action: manipulation; -webkit-tap-highlight-color: transparent; -webkit-touch-callout: none; }
/* Touch devices: enforce minimum 44px tap targets and 8px spacing (accessibility + mobile UX) */
@media (hover: none) and (pointer: coarse) {
    button, .kink-game-btn, .tap-btn, .mood-btn, .profile-tab, .edit-profile-btn, .glossary-close,
    #desires-save, #btn-reflections, #btn-boundaries, #btn-kink-ping, .reflections-form button, .boundaries-form button,
    .alter-ego-card-actions .kink-game-btn, .profile-edit-actions .kink-game-btn { min-height: var(--touch-min); min-width: var(--touch-min); padding: 0.5rem 0.75rem; }
    #card-stack .profile-card .card-actions .swipe-btn { min-width: 48px; min-height: 48px; }
    .tag-pill { min-height: var(--touch-min); padding: 0.5rem 0.85rem; line-height: 1.3; display: inline-block; }
    .tag-list { gap: 0.5rem; display: flex; flex-wrap: wrap; min-height: 2.5rem; }
    #desires-tag-list { display: flex; flex-wrap: wrap; visibility: visible; opacity: 1; min-height: min(18rem, 48vh); }
    .kink-game-rate .rate-btn { min-height: var(--touch-min); padding: 0.5rem 0.85rem; }
    .home-notification-bell, .app-profile-btn { min-width: 48px; min-height: 48px; }
    .bottom-nav a { min-width: 48px; }
    .chat-tab, .chat-send-as-btn { min-height: var(--touch-min); padding: 0.5rem 0.75rem; }
    .composer .send-btn, .composer-emoji-btn, .composer-attach-btn { min-width: 44px; min-height: 44px; }
    .settings-list li { min-height: var(--touch-min); padding: 0.75rem 1rem; }
    .app-profile-dropdown a, .home-notification-dropdown a { min-height: 48px; padding: 0.85rem 1rem; display: flex; align-items: center; }
    .home-checkin-item-mine .home-checkin-edit,
    .home-checkin-item-mine .home-checkin-delete { min-height: var(--touch-min); min-width: 44px; padding: 0.45rem 0.65rem; }
}
@media (max-width: 768px) {
    .home-notification-bell, .app-profile-btn { min-width: 48px; min-height: 48px; }
}
input:not([type="checkbox"]):not([type="radio"]), textarea { min-height: 44px; }
.app-footer { position: fixed; bottom: 0; left: 0; right: 0; width: 100%; z-index: 98; min-height: var(--footer-height); display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 0.25rem; text-align: center; padding: 0.5rem 0.75rem; padding-bottom: max(0.5rem, var(--safe-bottom)); padding-left: max(0.75rem, var(--safe-left)); padding-right: max(0.75rem, var(--safe-right)); font-size: 0.75rem; color: var(--text-muted); background: var(--chrome-glass); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); border-top: 1px solid var(--chrome-glass-border); line-height: 1.4; box-sizing: border-box; }
.app-footer a { color: var(--text-muted); text-decoration: none; }
.app-footer a:hover { color: var(--text); text-decoration: underline; }
.app-footer .footer-version { color: var(--text-muted); opacity: 0.9; }
.hidden { display: none !important; }
/* Accessibility: focus visible for keyboard nav, avoid focus ring on touch */
:focus:not(:focus-visible) { outline: none; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
button:focus-visible, a:focus-visible, [role="button"]:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* Privacy screen overlay (when app is backgrounded) */
.privacy-screen-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    top: 0; left: 0; right: 0; bottom: 0;
    pointer-events: none;
}
.privacy-screen-overlay.privacy-screen-blur {
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}
.privacy-screen-overlay.privacy-screen-solid {
    background-color: #1a1a1a;
}
.privacy-screen-overlay.privacy-screen-text,
.privacy-screen-overlay.privacy-screen-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    color: var(--text);
}
.privacy-screen-text-inner,
.privacy-screen-logo-inner {
    font-size: 1.5rem;
    font-weight: 600;
    opacity: 0.9;
}
.privacy-screen-logo-inner {
    font-size: 1.75rem;
    color: var(--primary);
}

/* Client-side vault unlock (password-derived; not stored on server) */
.crypto-unlock-overlay {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(26, 26, 46, 0.94);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}
.crypto-unlock-overlay.hidden {
    display: none !important;
}
.crypto-unlock-box {
    width: 100%;
    max-width: 380px;
    background: var(--surface);
    border-radius: 14px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    border: 1px solid rgba(255, 255, 255, 0.7);
}
[data-theme="dark"] .crypto-unlock-box {
    border-color: rgba(255, 255, 255, 0.1);
}
.crypto-unlock-title {
    margin: 0 0 0.5rem;
    font-size: 1.2rem;
    color: var(--text);
}
.crypto-unlock-desc {
    margin: 0 0 1rem;
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.45;
}
.crypto-unlock-label {
    display: block;
    font-size: 0.9rem;
    color: var(--text);
}
.crypto-unlock-label input {
    width: 100%;
    margin-top: 0.35rem;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    font-size: 1rem;
}
.crypto-unlock-btn {
    width: 100%;
    margin-top: 1rem;
}
.crypto-unlock-logout-btn {
    margin-top: 0.65rem;
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
    font-weight: 500;
}
.crypto-unlock-logout-btn:hover {
    color: var(--text);
    border-color: var(--text-muted);
    background: rgba(0, 0, 0, 0.04);
}
[data-theme="dark"] .crypto-unlock-logout-btn:hover {
    background: rgba(255, 255, 255, 0.06);
}
#crypto-unlock-error {
    margin-top: 0.75rem;
}

/* Terms & Conditions acceptance (blocks app until accepted) */
.terms-acceptance-overlay {
    position: fixed;
    inset: 0;
    z-index: 100001;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: max(0.75rem, var(--safe-top)) 1rem 1rem;
    padding-left: max(1rem, var(--safe-left));
    padding-right: max(1rem, var(--safe-right));
    padding-bottom: max(1rem, var(--safe-bottom));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: rgba(22, 18, 28, 0.88);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}
.terms-acceptance-overlay.hidden {
    display: none !important;
}
.terms-acceptance-box {
    width: 100%;
    max-width: 28rem;
    background: var(--surface);
    border-radius: 14px;
    padding: 1.15rem 1.2rem 1.25rem;
    box-shadow: var(--shadow);
    border: 1px solid rgba(255, 255, 255, 0.55);
    margin: 0 auto 1.5rem;
}
[data-theme="dark"] .terms-acceptance-box {
    border-color: rgba(255, 255, 255, 0.1);
}
.terms-acceptance-title {
    margin: 0 0 0.35rem;
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
}
.terms-acceptance-intro {
    margin: 0 0 0.85rem;
    font-size: 0.875rem;
    color: var(--text-muted);
    line-height: 1.45;
}
.terms-accept-scroll {
    max-height: min(52vh, 22rem);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1rem;
    padding: 0.65rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--input-fill);
    font-size: 0.8125rem;
    line-height: 1.45;
    color: var(--text);
}
.reconnect-terms-doc h2.reconnect-terms-doc-title {
    font-size: 1rem;
    margin: 0 0 0.5rem;
    line-height: 1.25;
}
.reconnect-terms-effective {
    font-size: 0.8125rem;
    margin: 0 0 0.75rem;
}
.reconnect-terms-doc h3 {
    font-size: 0.85rem;
    margin: 1rem 0 0.35rem;
    color: var(--text);
}
.reconnect-terms-doc p {
    margin: 0 0 0.5rem;
}
.reconnect-terms-doc ul {
    margin: 0.25rem 0 0.5rem 1.1rem;
    padding: 0;
}
.reconnect-terms-doc li {
    margin: 0.2rem 0;
}
.reconnect-terms-doc a {
    color: var(--primary);
    word-break: break-word;
}
.reconnect-terms-declaration {
    margin: 0 0 1rem;
    padding: 0.65rem 0.75rem;
    border-left: 3px solid var(--primary);
    background: rgba(233, 30, 99, 0.06);
    border-radius: 0 8px 8px 0;
    font-size: 0.8125rem;
    line-height: 1.5;
}
.reconnect-terms-declaration p {
    margin: 0 0 0.5rem;
}
.reconnect-terms-declaration p:last-child {
    margin-bottom: 0;
}
.terms-accept-check {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    margin: 0 0 0.65rem;
    font-size: 0.8125rem;
    line-height: 1.4;
    cursor: pointer;
    color: var(--text);
}
.terms-accept-check input {
    width: 1.1rem;
    height: 1.1rem;
    margin-top: 0.15rem;
    flex-shrink: 0;
    accent-color: var(--primary);
}
.terms-accept-btn-full {
    width: 100%;
    margin-top: 0.5rem;
}
.terms-step.hidden {
    display: none !important;
}

/* Signup page — terms wizard (uses same doc classes) */
.signup-terms-scroll {
    max-height: min(50vh, 20rem);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    margin: 1rem 0;
    padding: 0.65rem 0.75rem;
    border: 1px solid #e8e6ed;
    border-radius: 10px;
    background: #faf9fc;
    font-size: 0.8125rem;
    line-height: 1.45;
    color: #16161f;
}
.signup-terms-actions {
    margin-top: 0.75rem;
}
.signup-terms-actions .kink-game-btn {
    width: 100%;
    margin-top: 0.5rem;
}

/* Login — card on fixed shell gradient (see reconnect-shell.css) */
#login-screen { min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 1rem; padding-left: max(1rem, var(--safe-left)); padding-right: max(1rem, var(--safe-right)); padding-bottom: max(1rem, var(--safe-bottom)); background: transparent; }
.login-box { width: 100%; max-width: 360px; background: var(--surface); padding: 2rem; border-radius: 14px; box-shadow: var(--shadow); border: 1px solid rgba(255, 255, 255, 0.7); }
[data-theme="dark"] .login-box { border-color: rgba(255, 255, 255, 0.08); }
.login-box h1 { margin: 0 0 .5rem; font-size: 1.75rem; font-weight: 700; letter-spacing: -0.03em; color: var(--primary); }
.login-box .tagline { color: var(--text-muted); font-size: .9rem; margin-bottom: 1.5rem; line-height: 1.45; }
.login-box label { display: block; margin-bottom: 1rem; font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); }
.login-box input { width: 100%; padding: .5rem .7rem; border: 1px solid var(--border); border-radius: 10px; font-size: 1rem; min-height: 42px; background: #faf9fc; margin-top: 0.3rem; font-family: inherit; transition: border-color 0.15s, box-shadow 0.15s, background 0.15s; }
[data-theme="dark"] .login-box input { background: rgba(255, 255, 255, 0.04); }
.login-box input:focus { outline: none; border-color: var(--primary); background: var(--surface); box-shadow: 0 0 0 3px rgba(233, 30, 99, 0.12); }
.login-box button { width: 100%; padding: .6rem 1rem; background: var(--primary); color: #fff; border: none; border-radius: 10px; font-size: 1rem; font-weight: 600; cursor: pointer; margin-top: .5rem; min-height: 44px; font-family: inherit; transition: background 0.15s, transform 0.1s; touch-action: manipulation; }
.login-box button:hover { background: var(--primary-dark); }
.login-box button:active { transform: scale(0.98); }
.login-error { color: #d32f2f; font-size: .9rem; margin-top: .5rem; }
.login-error--info { color: var(--text); font-size: .9rem; margin-top: .5rem; border-left: 4px solid #c2410c; padding: 0.5rem 0.75rem; background: rgba(194, 65, 12, 0.08); border-radius: 0 8px 8px 0; }
[data-theme="dark"] .login-error--info { background: rgba(251, 146, 60, 0.12); }

.settings-sign-in-device-card {
    margin-top: 0.35rem;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--surface);
}
.settings-sign-in-device-line { margin: 0.35rem 0; font-size: 0.9rem; line-height: 1.45; color: var(--text); }
.settings-sign-in-policy { margin: 0.5rem 0 0.75rem !important; font-size: 0.85rem !important; }
.settings-sign-in-ua-details { margin-top: 0.65rem; font-size: 0.85rem; }
.settings-sign-in-ua-details summary { cursor: pointer; color: var(--primary); font-weight: 600; }
.settings-sign-in-ua-pre {
    margin: 0.5rem 0 0;
    padding: 0.5rem;
    font-size: 0.72rem;
    line-height: 1.35;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
    background: rgba(0, 0, 0, 0.04);
    border-radius: 8px;
}
[data-theme="dark"] .settings-sign-in-ua-pre { background: rgba(255, 255, 255, 0.06); }
.settings-sign-in-device-log-hint code { font-size: 0.78em; }
.login-success { color: var(--success, #2e7d32); font-size: .9rem; margin-bottom: 1rem; }

/* App shell — single scroll: .main-content only; body/html do not scroll */
#app-shell { padding-bottom: calc(var(--nav-height) + var(--safe-bottom) + var(--footer-height)); padding-top: var(--top-bar-height); }
.main-content { scroll-padding-bottom: calc(var(--nav-height) + var(--safe-bottom) + var(--footer-height) + 1rem); }
/* No overflow on .panel so it does not become a scroll container; .main-content is the only scroll. Horizontal overflow is clipped by .main-content. */
.panel { display: none; padding: 1rem; padding-left: max(1rem, var(--safe-left)); padding-right: max(1rem, var(--safe-right)); padding-bottom: 1.5rem; }
.panel.active { display: block !important; }
.panel.hidden { display: none !important; }
/* Chat panel: contained viewport (Samsung Galaxy / mobile). One scroll bar (messages only). Composer above nav. */
#panel-chat.active {
    display: flex !important;
    flex-direction: column;
    position: fixed;
    top: var(--top-bar-height);
    left: 0;
    right: 0;
    bottom: calc(var(--nav-height) + var(--safe-bottom) + var(--footer-height));
    /* Do not set height together with bottom — conflicting used sizes + overflow:hidden clipped the composer on mobile (flex column). */
    width: 100%;
    min-height: 0;
    padding: 0;
    margin: 0;
    overflow: hidden;
    background: var(--chrome-glass);
    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);
    z-index: 50;
}
#panel-chat.active .chat-header,
#panel-chat.active .stories-bar,
#panel-chat.active .chat-conversation-tabs,
#panel-chat.active #chat-send-as-wrap { flex-shrink: 0; }
#panel-chat.active #messages {
    flex: 1;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0.75rem;
    padding-left: max(0.75rem, var(--safe-left));
    padding-right: max(0.75rem, var(--safe-right));
    max-height: none;
    direction: ltr;
}
#panel-chat.active .composer {
    flex-shrink: 0;
    padding-left: max(0.75rem, var(--safe-left));
    padding-right: max(0.75rem, var(--safe-right));
    padding-bottom: max(0.5rem, var(--safe-bottom));
    border-top: 1px solid var(--border);
    background: var(--surface);
}
/* Site-wide: images and stills never overflow; responsive */
.panel .media, .panel .explore-shared-img, .panel .explore-shared-video, .panel .chat-video { max-width: 100%; height: auto; }
.panel img:not([width]) { max-width: 100%; height: auto; vertical-align: middle; }
.prefs-checkboxes label { display: block; margin: 0.4rem 0; }
.prefs-checkboxes input { margin-right: 0.5rem; }
.explore-categories { margin: 0.5rem 0; padding-left: 1.2rem; }
.explore-categories li { margin: 0.25rem 0; }

/* Bottom nav — same on web and mobile: one row, same size, scroll horizontally on narrow screens */
.bottom-nav { position: fixed; bottom: var(--footer-height); left: 0; right: 0; width: 100%; height: calc(var(--nav-height) + var(--safe-bottom)); padding-bottom: var(--safe-bottom); padding-left: max(0.5rem, env(safe-area-inset-left, 0)); padding-right: max(0.5rem, env(safe-area-inset-right, 0)); background: var(--chrome-glass); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); border-top: 1px solid var(--chrome-glass-border); display: flex; justify-content: space-around; align-items: center; z-index: 199; pointer-events: auto; overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; flex-wrap: nowrap; box-sizing: border-box; }
.bottom-nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--text-muted); text-decoration: none; font-size: .7rem; padding: .5rem .6rem; min-height: var(--touch-min); min-width: 44px; flex-shrink: 0; border-radius: 8px; -webkit-tap-highlight-color: transparent; }
.bottom-nav a.active { color: var(--primary); font-weight: 600; }
.bottom-nav a { position: relative; }
.bottom-nav a .icon { font-size: 1.5rem; margin-bottom: .15rem; }
.nav-badge { position: absolute; top: -2px; right: -4px; min-width: 1.1em; height: 1.1em; padding: 0 0.25em; font-size: 0.65rem; font-weight: 700; line-height: 1.1em; color: #fff; background: var(--primary); border-radius: 999px; display: none; align-items: center; justify-content: center; box-sizing: border-box; }
.nav-badge.nav-badge-visible { display: inline-flex; }

/* Match / Home — card stack */
.home-top { display: flex; align-items: center; justify-content: flex-end; padding: 0.5rem 1rem 0; position: relative; min-height: 40px; }
.home-top-spacer { flex: 1; }
.home-notification-bell { position: relative; background: none; border: none; cursor: pointer; font-size: 1.5rem; padding: 0.5rem; min-width: 44px; min-height: 44px; line-height: 1; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; }
.home-notification-bell:hover { background: var(--surface); }
.home-notification-badge { position: absolute; top: 2px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px; font-size: 0.7rem; font-weight: 700; color: #fff; background: var(--primary); border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; }
.home-notification-badge.hidden { display: none; }
.home-notification-dropdown { position: absolute; top: 100%; right: 0; margin-top: 0.35rem; min-width: 200px; max-width: min(320px, calc(100vw - 2rem)); background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); z-index: 1000; padding: 0.5rem 0; }
.home-notification-dropdown.hidden { display: none; }
.home-notification-row { display: flex; align-items: center; gap: 0.25rem; }
.home-notification-row .home-notification-item { flex: 1; display: block; padding: 0.75rem 1rem; min-height: 44px; box-sizing: border-box; color: var(--text); text-decoration: none; font-size: 0.95rem; border: none; background: none; width: 100%; text-align: left; cursor: pointer; }
.home-notification-row .home-notification-item:hover, .home-notification-row .home-notification-item:active { background: var(--bg); }
.home-notification-dismiss { flex-shrink: 0; width: 44px; height: 44px; min-width: 44px; min-height: 44px; padding: 0; border: none; background: none; color: var(--text-muted); font-size: 1.25rem; line-height: 1; cursor: pointer; border-radius: 8px; display: flex; align-items: center; justify-content: center; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.home-notification-dismiss:hover, .home-notification-dismiss:focus { background: var(--bg); color: var(--text); }
.home-notification-dropdown a { display: block; padding: 0.75rem 1rem; min-height: 44px; box-sizing: border-box; color: var(--text); text-decoration: none; font-size: 0.95rem; border: none; background: none; width: 100%; text-align: left; cursor: pointer; }
.home-notification-dropdown a:hover, .home-notification-dropdown a:active { background: var(--bg); }
.home-notification-empty { margin: 0; padding: 0.75rem 1rem; font-size: 0.9rem; color: var(--text-muted); }
.home-notification-mark-all { padding: 0.5rem 1rem; border-bottom: 1px solid var(--border); }
.home-notification-mark-all-btn { padding: 0.6rem 0.75rem; min-height: 44px; font-size: 0.85rem; background: var(--primary); color: #fff; border: none; border-radius: 8px; cursor: pointer; width: 100%; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.home-notification-mark-all-btn:hover, .home-notification-mark-all-btn:active { opacity: 0.9; }
.home-notification-individual-list { border-top: 1px solid var(--border); max-height: 200px; overflow-y: auto; }
.home-notification-individual-list .home-notification-row { border-bottom: 1px solid var(--border); }
.home-notification-individual-list .home-notification-row:last-child { border-bottom: none; }
.home-notification-individual-row { cursor: pointer; }
.home-notification-individual-row:hover, .home-notification-individual-row:active { background: var(--bg); }

.home-last-login-line {
    margin: 0 1rem 0.5rem;
    padding: 0 0.15rem;
    font-size: 0.78rem;
    line-height: 1.45;
    color: var(--text-muted);
    text-align: center;
}
.home-last-login-line.hidden { display: none !important; }
.home-last-login-line .home-last-login-strong {
    font-weight: 600;
    color: var(--text);
}
.home-last-login-line .home-last-login-time { color: var(--text-muted); font-weight: 400; }
.home-last-login-line .home-last-login-sep {
    color: var(--text-muted);
    opacity: 0.75;
    padding: 0 0.15rem;
}

.match-header { text-align: center; padding: 1rem 0; cursor: pointer; min-height: 44px; display: flex; flex-direction: column; justify-content: center; }
.match-header:hover { color: var(--text); }
.match-header:focus { outline: 2px solid var(--accent); outline-offset: 2px; }
.match-header h2 { margin: 0; font-size: 1.25rem; color: var(--text); pointer-events: none; }
.match-header p { margin: .35rem 0 0; font-size: .9rem; color: var(--text-muted); pointer-events: none; }
.card-stack { position: relative; max-width: 360px; margin: 0 auto; min-height: 0; z-index: 1; touch-action: pan-y; }
/* Always column-flex home cards (do not rely only on :has() — older WebViews drop those rules). */
.card-stack .profile-card { position: relative; left: 0; transform: none; width: 100%; max-width: 340px; margin: 0 auto; display: flex; flex-direction: column; }
.card-stack-item { position: absolute; left: 50%; width: 92%; max-width: 340px; top: 0; }
.card-stack-item-0 { z-index: 3; transform: translateX(-50%); }
.card-stack-item-0 .profile-card { touch-action: none; }
.card-stack-item-1 { z-index: 2; transform: translateX(-50%) scale(0.96) translateY(12px); pointer-events: none; }
.card-stack-item-2 { z-index: 1; transform: translateX(-50%) scale(0.92) translateY(24px); pointer-events: none; }
.card-stack-item .profile-card { position: relative; left: 0; transform: none; width: 100%; max-height: 75vh; }
.card-stack-item .profile-card .card-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
.card-stack-item .profile-card .card-actions { flex-shrink: 0; }
.card-stack-item-0 .profile-card .card-actions { position: relative; z-index: 2; }
#card-stack:has(.card-stack-item) { min-height: 70vh; }
/* Single card in stack (no card-stack-item wrapper): constrain height so it doesn't overlap content below */
#card-stack:not(:has(.card-stack-item)) .profile-card { max-height: 82vh; }
#card-stack:not(:has(.card-stack-item)) .profile-card .card-photo-wrap { flex: 0 0 auto; }
#card-stack:not(:has(.card-stack-item)) .profile-card .card-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
#card-stack:not(:has(.card-stack-item)) .profile-card .card-actions { flex-shrink: 0; position: relative; z-index: 2; }
.profile-card { width: 92%; max-width: 340px; background: var(--surface); border-radius: 20px; box-shadow: var(--shadow); border: 1px solid rgba(255, 255, 255, 0.55); overflow: hidden; transition: transform .25s ease; touch-action: pan-y; cursor: grab; }
[data-theme="dark"] .profile-card { border-color: rgba(255, 255, 255, 0.08); }
.profile-card.card-dragging { cursor: grabbing; will-change: transform; }
.profile-card:active { cursor: grabbing; }
.card-swipe-overlay { position: absolute; inset: 0; pointer-events: none; display: flex; align-items: center; justify-content: center; border-radius: 20px; transition: opacity .12s ease; opacity: 0; }
.card-swipe-overlay-left { flex-direction: column; justify-content: center; align-items: flex-start; padding-left: 12%; background: linear-gradient(to right, rgba(200, 60, 60, 0.35), transparent); gap: 0.1em; }
.card-swipe-overlay-right { justify-content: flex-end; padding-right: 12%; background: linear-gradient(to left, rgba(233, 30, 99, 0.35), transparent); }
.card-swipe-x { font-size: clamp(4rem, 18vw, 7rem); font-weight: 800; color: rgba(255,255,255,.95); text-shadow: 0 2px 8px rgba(0,0,0,.4); line-height: 1; }
.card-swipe-sad { font-size: clamp(2rem, 10vw, 3.5rem); margin-left: 0.15em; filter: drop-shadow(0 2px 4px rgba(0,0,0,.3)); }
.card-swipe-hearts { font-size: clamp(3rem, 14vw, 6rem); color: rgba(255,255,255,.95); text-shadow: 0 2px 8px rgba(0,0,0,.35); letter-spacing: 0.05em; }
.profile-card .card-photo-wrap { position: relative; width: 100%; aspect-ratio: 3/4; background: var(--border); }
.profile-card .card-photo { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-photo-loading-msg { position: absolute; top: 0; right: 0; bottom: 0; left: 0; display: none; -webkit-box-orient: vertical; -webkit-box-direction: normal; -webkit-flex-direction: column; flex-direction: column; -webkit-box-pack: center; -webkit-box-align: center; -webkit-align-items: center; align-items: center; -webkit-justify-content: center; justify-content: center; gap: 0.5rem; text-align: center; padding: 1rem; background: rgba(0,0,0,.42); color: #fff; font-size: 0.88rem; font-weight: 500; line-height: 1.35; z-index: 2; pointer-events: none; }
.card-photo-loading-msg .loader.reconnect-heart-loader { margin: 0; width: 52px; height: 52px; }
.card-photo-loading-msg .reconnect-heart-loader-track { stroke: rgba(255,255,255,.35); }
.card-photo-loading-msg .reconnect-heart-loader-active { stroke: #fff; }
.card-photo-loading-text { max-width: 12rem; }
/* Adjacent sibling (works on older mobile WebViews; :has() kept as progressive enhancement) */
.card-photo.reconnect-media-loading + .card-photo-loading-msg { display: -webkit-box; display: flex; }
.card-photo-wrap:has(.card-photo.reconnect-media-loading) .card-photo-loading-msg { display: -webkit-box; display: flex; }
.profile-card .card-photo-empty { position: absolute; left: 0; right: 0; bottom: 0; padding: 1rem; background: linear-gradient(transparent, rgba(0,0,0,.6)); color: #fff; font-size: 0.9rem; text-align: center; display: flex; align-items: flex-end; justify-content: center; min-height: 4rem; line-height: 1.3; z-index: 1; }
.profile-card .card-body { padding: 1rem 1.25rem; }
.profile-card .card-name { font-size: 1.35rem; font-weight: 700; margin: 0 0 .25rem; }
.profile-card .card-role { font-size: .85rem; color: var(--text-muted); margin-bottom: .5rem; }
.profile-card .card-relationship { font-size: .82rem; color: var(--text-muted); margin: 0.1rem 0 0.2rem; line-height: 1.35; }
.profile-card .card-seeking { font-size: .8rem; color: var(--text-muted); margin-bottom: 0.35rem; line-height: 1.35; }
.profile-card .card-seeking .card-seeking-label { font-weight: 600; color: var(--text); opacity: 0.85; margin-right: 0.25rem; }
.profile-card .card-sexuality { font-size: .82rem; color: var(--text-muted); margin: 0.1rem 0 0.2rem; line-height: 1.35; }
.profile-card .card-sexuality-seeking { font-size: .8rem; color: var(--text-muted); margin-bottom: 0.35rem; line-height: 1.35; }
.profile-card .card-bio { font-size: .9rem; color: var(--text); line-height: 1.4; }
.profile-card .card-actions { display: flex; justify-content: center; align-items: center; gap: 1rem; margin-top: 0.75rem; padding-top: 0.5rem; flex-shrink: 0; min-height: 52px; }
.profile-card .card-actions .swipe-btn { width: 48px; height: 48px; min-width: 48px; min-height: 48px; font-size: 1.4rem; flex-shrink: 0; }
#card-stack .profile-card .card-body { display: flex; flex-direction: column; }
/* Flex children need min-width:0 so long names / labels wrap instead of clipping horizontally */
#card-stack .profile-card .card-body > * { min-width: 0; }
#card-stack .profile-card .card-name {
    overflow-wrap: anywhere;
    word-break: break-word;
    line-height: 1.25;
}
#card-stack .profile-card .card-role,
#card-stack .profile-card .card-relationship,
#card-stack .profile-card .card-seeking,
#card-stack .profile-card .card-sexuality,
#card-stack .profile-card .card-sexuality-seeking,
#card-stack .profile-card .card-bio {
    overflow-wrap: anywhere;
    word-break: break-word;
}
#card-stack .profile-card .card-actions { margin-top: auto; }
/* Ensure card action buttons are visible and tappable on mobile */
#card-stack .profile-card .card-actions { position: relative; z-index: 2; }
#card-stack .profile-card .card-actions .swipe-btn { position: relative; z-index: 2; pointer-events: auto; }
.card-stack-alter-egos { display: flex; flex-wrap: wrap; justify-content: center; gap: 1rem; margin-top: 1.5rem; padding: 0 0.5rem; }
.card-stack-alter-egos.hidden { display: none; }
.card-stack-alter-ego-item { width: 100%; max-width: 160px; }
.card-stack-alter-ego-item .profile-card { position: relative; left: 0; transform: none; width: 100%; max-width: none; }
.card-stack-alter-ego-item .card-photo-wrap { aspect-ratio: 3/4; }
.card-stack-alter-ego-item .card-body { padding: 0.6rem 0.75rem; }
.card-stack-alter-ego-item .card-name { font-size: 1rem; }
/* Match .alter-ego-card-img: fixed circle so encrypted-media shell does not stretch to full card width */
.alter-ego-card .reconnect-media-shell {
    flex-shrink: 0;
    width: 64px;
    height: 64px;
    min-width: 64px;
    min-height: 64px;
    border-radius: 50%;
    overflow: hidden;
    display: block;
    background: var(--border);
}
.alter-ego-card .reconnect-media-shell.reconnect-media-shell--busy {
    min-width: 64px;
    min-height: 64px;
}
.alter-ego-card .reconnect-media-shell > img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    border-radius: 50%;
}
/* Override global .reconnect-media-shell--busy > img min sizes (would force a wide/tall box) */
.alter-ego-card .reconnect-media-shell--busy > img.alter-ego-card-img {
    min-width: 0;
    min-height: 0;
    max-width: none;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.alter-ego-card .reconnect-media-shell-overlay {
    border-radius: 50%;
}
.card-stack-alter-ego-item .card-bio { font-size: 0.8rem; }
.swipe-hint { text-align: center; margin-top: 1rem; font-size: .85rem; color: var(--text-muted); }
.swipe-buttons { display: flex; justify-content: center; gap: 2rem; margin-top: 1.5rem; padding: 0 1rem; position: relative; z-index: 2; }
.swipe-btn { width: 64px; height: 64px; border-radius: 50%; border: none; font-size: 1.8rem; cursor: pointer; display: flex; align-items: center; justify-content: center; background: var(--surface); box-shadow: var(--shadow); }
.swipe-btn.reject { color: #999; }
.swipe-btn.like { background: var(--primary); color: #fff; }
.swipe-btn.like:hover { background: var(--primary-dark); }
/* Match overlay */
.match-overlay { position: fixed; inset: 0; background: var(--match-bg); display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 200; padding: 2rem; animation: fadeIn .4s ease; }
.match-overlay h3 { color: #fff; font-size: 2rem; margin: 0 0 .5rem; text-shadow: 0 1px 2px rgba(0,0,0,.2); }
.match-overlay p { color: rgba(255,255,255,.95); font-size: 1.1rem; margin-bottom: 2rem; }
.match-overlay .btn { padding: .85rem 2rem; background: #fff; color: var(--primary); border: none; border-radius: 12px; font-weight: 600; cursor: pointer; }
.new-match-overlay .new-match-overlay-desc { margin-bottom: 1rem; }
.new-match-overlay-card { max-width: 280px; width: 100%; margin: 0 auto 1.25rem; border-radius: 16px; overflow: hidden; box-shadow: 0 8px 24px rgba(0,0,0,.2); background: var(--surface); }
.new-match-overlay-card .profile-card { position: relative; left: 0; transform: none; width: 100%; max-width: none; }
.new-match-overlay-card .card-photo-wrap { aspect-ratio: 3/4; }
.new-match-overlay-card .card-body { padding: 0.75rem 1rem; }
.new-match-overlay-card .card-name { font-size: 1.15rem; }
.new-match-overlay-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.75rem; margin-bottom: 1rem; }
.new-match-overlay .btn-primary { background: var(--primary); color: #fff; }
.new-match-overlay .btn-ghost { background: transparent; color: rgba(255,255,255,.9); }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.card-swipe-right { animation: swipeRight .4s ease forwards; }
.card-swipe-left { animation: swipeLeft .4s ease forwards; }
@keyframes swipeRight { to { transform: translateX(120%) translateY(-50px) scale(0.8); opacity: 0; } }
@keyframes swipeLeft { to { transform: translateX(-120%) translateY(-50px) scale(0.8); opacity: 0; } }

/* New match banner (when partner adds alter ego) */
.home-new-match { text-align: center; padding: 0.5rem 1rem; margin-bottom: 0.5rem; background: var(--primary-light); color: var(--primary-dark); border-radius: 10px; font-weight: 600; font-size: 0.95rem; }
.home-new-match.hidden { display: none; }

/* Reconnected today — show chat CTA */
.reconnected-cta { background: var(--primary); color: #fff; text-align: center; padding: 1rem; border-radius: 12px; margin: 1rem 0; }
.reconnected-cta p { margin: 0 0 .5rem; font-weight: 600; }
.reconnected-cta a { color: #fff; text-decoration: underline; }
.home-partner-summary { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 0.85rem 1rem; margin-bottom: 1rem; }
.home-partner-summary.hidden { display: none; }
.home-partner-summary-text { margin: 0 0 0.5rem; font-size: 0.95rem; color: var(--text); }
.home-partner-summary a { display: inline-block; margin-top: 0.25rem; }

/* Chat */
/* pointer-events: bar is full-width; only tool clusters capture taps so the flex “gap” doesn’t eat touches on content scrolling underneath (fixes dead nav / frozen page). */
.app-top-bar { position: fixed; top: 0; left: 0; right: 0; width: 100%; max-width: 100vw; z-index: 200; height: var(--top-bar-height); min-height: 52px; display: flex; flex-wrap: nowrap; align-items: center; justify-content: flex-start; gap: 0.5rem; padding: 0.5rem 1rem; padding-top: max(0.5rem, var(--safe-top)); padding-left: max(1rem, var(--safe-left)); padding-right: max(1rem, var(--safe-right)); background: var(--chrome-glass); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); border-bottom: 1px solid var(--chrome-glass-border); overflow: visible; -webkit-tap-highlight-color: transparent; pointer-events: none; box-sizing: border-box; }
.app-top-bar-left,
.app-top-bar-right { pointer-events: auto; }
.app-top-bar-left { display: flex; align-items: center; gap: 0.35rem; flex-shrink: 0; flex-grow: 0; min-height: 48px; }
.app-top-bar-right { display: flex; align-items: center; gap: 0.25rem; flex-shrink: 0; flex-grow: 0; margin-left: auto; min-height: 48px; }
.reconnect-points-wrap { display: inline-flex; align-items: center; justify-content: flex-start; gap: 0.2rem; padding: 0.2rem 0.55rem 0.2rem 0.35rem; border-radius: 999px; background: var(--primary-light, rgba(99,102,241,0.12)); border: 1px solid var(--border); max-width: min(200px, 42vw); min-width: 6.75rem; cursor: pointer; flex-shrink: 0; pointer-events: auto; }
.reconnect-points-wrap:focus-visible { outline: 2px solid var(--primary, #6366f1); outline-offset: 2px; }
.reconnect-points-icon { font-size: 1rem; line-height: 1; flex-shrink: 0; }
.reconnect-points-value { font-weight: 700; font-size: 0.95rem; line-height: 1; color: var(--primary-dark, var(--primary)); font-variant-numeric: tabular-nums; min-width: 2.5ch; display: inline-block; text-align: center; }
.reconnect-points-vs { font-size: 0.72rem; line-height: 1.2; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 5.5rem; flex-shrink: 0; }
.reconnect-points-vs.hidden { display: none !important; }
.app-profile-btn.app-profile-btn-leading::after { content: '👑'; position: absolute; top: -2px; right: -2px; font-size: 0.75rem; line-height: 1; filter: drop-shadow(0 1px 1px rgba(0,0,0,0.2)); pointer-events: none; }
.reconnect-points-explainer { padding: 0.65rem 1rem 0.85rem; padding-left: max(1rem, var(--safe-left)); padding-right: max(1rem, var(--safe-right)); background: var(--bg); border-bottom: 1px solid var(--border); font-size: 0.85rem; line-height: 1.45; color: var(--text); }
.reconnect-points-explainer p { margin: 0; }
.reconnect-points-explainer strong { color: var(--text); }
.reconnect-month-modal, .feature-request-modal, .reconnect-points-detail-modal { position: fixed; inset: 0; z-index: 400; display: flex; align-items: center; justify-content: center; padding: 1rem; box-sizing: border-box; }
.reconnect-month-modal.hidden, .feature-request-modal.hidden, .reconnect-points-detail-modal.hidden { display: none !important; }
.reconnect-month-modal-backdrop, .feature-request-modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.45); }
.reconnect-month-modal-box, .feature-request-modal-box { position: relative; z-index: 1; width: 100%; max-width: 420px; max-height: 90vh; overflow-y: auto; background: var(--surface); border-radius: 16px; padding: 1.25rem; box-shadow: var(--shadow); border: 1px solid var(--border); }
.reconnect-month-modal-box h3, .feature-request-modal-box h3 { margin: 0 0 0.75rem; font-size: 1.05rem; }
.reconnect-month-modal-body, .feature-request-modal-intro { font-size: 0.9rem; line-height: 1.45; color: var(--text); margin-bottom: 1rem; }
.feature-request-form label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 0.35rem; }
.feature-request-form textarea { width: 100%; box-sizing: border-box; margin-bottom: 0.65rem; padding: 0.5rem 0.65rem; border-radius: 8px; border: 1px solid var(--border); font: inherit; font-size: 0.9rem; min-height: 7rem; resize: vertical; }
.feature-request-honeypot { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; opacity: 0; pointer-events: none; }
.feature-request-status { font-size: 0.85rem; margin: 0 0 0.65rem; min-height: 1.25em; }
.feature-request-status.hidden { display: none !important; }
.feature-request-status.is-ok { color: #2e7d32; }
.feature-request-status.is-err { color: #c62828; }
.feature-request-modal-actions { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 0.25rem; }
.feature-request-modal-actions .kink-game-btn { width: 100%; }
.reconnect-month-task-form label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 0.35rem; }
.reconnect-month-task-form textarea { width: 100%; box-sizing: border-box; margin-bottom: 0.65rem; padding: 0.5rem 0.65rem; border-radius: 8px; border: 1px solid var(--border); font: inherit; font-size: 0.9rem; min-height: 5rem; }
.reconnect-month-task-form .kink-game-btn { margin-bottom: 0.5rem; }
.reconnect-month-modal-dismiss { width: 100%; margin-top: 0.25rem; }

.reconnect-points-detail-box {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: min(560px, 100%);
    max-height: min(88vh, 720px);
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border-radius: 16px;
    padding: 1.1rem 1.15rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}
.reconnect-points-detail-box h3 { margin: 0 0 0.5rem; font-size: 1.05rem; }
.reconnect-points-detail-summary { margin: 0 0 0.65rem; font-size: 0.88rem; line-height: 1.45; }
.reconnect-points-detail-body { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.reconnect-points-detail-table-wrap {
    flex: 1 1 auto;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--border);
    border-radius: 10px;
    max-height: min(42vh, 320px);
}
.reconnect-points-detail-table { width: 100%; border-collapse: collapse; font-size: 0.78rem; }
.reconnect-points-detail-table th,
.reconnect-points-detail-table td { padding: 0.35rem 0.45rem; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
.reconnect-points-detail-table th { position: sticky; top: 0; background: var(--surface); z-index: 1; font-weight: 600; color: var(--text-muted); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.02em; }
.reconnect-points-detail-table td { color: var(--text); }
.reconnect-points-detail-table .rpd-num { font-variant-numeric: tabular-nums; font-weight: 700; white-space: nowrap; }
.reconnect-points-detail-table .rpd-when { white-space: nowrap; font-variant-numeric: tabular-nums; }
.reconnect-points-detail-more { width: 100%; }
.reconnect-points-detail-close { width: 100%; margin-top: 0.5rem; }
.reconnect-points-detail-loading,
.reconnect-points-detail-error { margin: 0.25rem 0; font-size: 0.88rem; }
.reconnect-points-detail-error { color: #b91c1c; }
.app-top-bar-bell-wrap { position: relative; display: flex; align-items: center; z-index: 1; }
.app-profile-wrap { position: relative; display: flex; align-items: center; z-index: 1; }
.app-refresh-btn { display: flex; align-items: center; justify-content: center; width: 48px; height: 48px; min-width: 48px; min-height: 48px; padding: 0; border: none; border-radius: 50%; background: transparent; font-size: 1.25rem; cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation; position: relative; z-index: 10; flex-shrink: 0; pointer-events: auto; }
.app-refresh-btn:hover, .app-refresh-btn:active { background: var(--bg); }
.home-notification-bell { position: relative; z-index: 1; }
.app-profile-btn { display: flex; align-items: center; justify-content: center; width: 48px; height: 48px; min-width: 48px; min-height: 48px; padding: 0; border: none; border-radius: 50%; background: transparent; font-size: 1.5rem; cursor: pointer; -webkit-tap-highlight-color: transparent; position: relative; z-index: 1; }
.app-profile-btn:hover, .app-profile-btn:active { background: var(--bg); }
.app-profile-dropdown { position: absolute; top: 100%; right: 0; margin-top: 0.35rem; min-width: 200px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); z-index: 1000; padding: 0.5rem 0; }
.app-profile-dropdown.hidden { display: none; }
.app-profile-dropdown-item { display: block; padding: 0.75rem 1rem; min-height: 44px; box-sizing: border-box; color: var(--text); text-decoration: none; font-size: 0.95rem; border: none; background: none; width: 100%; text-align: left; cursor: pointer; }
.app-profile-dropdown-item:hover, .app-profile-dropdown-item:active { background: var(--bg); }
.app-profile-dropdown-item[data-profile-menu="logout"] { border-top: 1px solid var(--border); margin-top: 0.25rem; padding-top: 0.75rem; }
.chat-header { padding: .75rem 1rem; padding-left: max(1rem, var(--safe-left)); padding-right: max(1rem, var(--safe-right)); background: var(--surface); border-bottom: 1px solid var(--border); font-weight: 600; width: 100%; box-sizing: border-box; }
.chat-header-with-close { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.profile-close-btn { display: flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; width: 44px; height: 44px; padding: 0; border: none; border-radius: 50%; background: var(--border, #e0e0e0); color: var(--text, #333); font-size: 1.5rem; line-height: 1; cursor: pointer; transition: background .2s, color .2s; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.profile-close-btn:hover { background: var(--primary); color: #fff; }
.profile-close-btn:focus { outline: none; box-shadow: 0 0 0 2px var(--primary); }
.connect-sub-tabs { display: flex; gap: 0; padding: 0 .5rem; background: var(--surface); border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.connect-sub-tab { flex: 1; min-width: 0; padding: .5rem .6rem; border: none; border-bottom: 3px solid transparent; background: transparent; color: var(--text-muted); font-size: .85rem; cursor: pointer; white-space: nowrap; }
.connect-sub-tab:hover { color: var(--text); }
.connect-sub-tab.active { color: var(--primary); font-weight: 600; border-bottom-color: var(--primary); }
.connect-tab-content { display: block; }
.connect-tab-content.hidden { display: none; }
.chat-conversation-tabs { display: flex; align-items: center; gap: 0.5rem; padding: 0 .5rem; background: var(--surface); border-bottom: 1px solid var(--border); overflow-x: auto; flex-shrink: 0; }
.chat-conversation-tabs.hidden { display: none; }
.chat-with-label { flex-shrink: 0; font-size: 0.85rem; color: var(--text-muted); font-weight: 500; }
.chat-with-tabs { display: flex; gap: 0; flex-shrink: 1; min-width: 0; overflow-x: auto; }
.chat-tab { flex-shrink: 0; padding: .5rem .85rem; border: none; border-bottom: 3px solid transparent; background: transparent; color: var(--text-muted); font-size: .9rem; cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 0.35rem; }
.chat-tab:hover { color: var(--text); }
.chat-tab.active { color: var(--primary); font-weight: 600; border-bottom-color: var(--primary); }
.chat-tab-badge { font-size: 0.7rem; font-weight: 600; padding: 0.1rem 0.4rem; border-radius: 999px; background: var(--primary); color: #fff; }
.chat-tab-new.active .chat-tab-badge { background: #fff; color: var(--primary); }
.chat-send-as { display: flex; align-items: center; gap: 0.5rem; padding: 0.4rem 1rem; background: var(--surface); border-bottom: 1px solid var(--border); flex-shrink: 0; }
.chat-send-as.hidden { display: none; }
.chat-send-as-label { font-size: 0.85rem; color: var(--text-muted); }
.chat-send-as-btns { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.chat-send-as-btn { padding: 0.25rem 0.6rem; border: 1px solid var(--border); border-radius: 999px; background: transparent; color: var(--text-muted); font-size: 0.8rem; cursor: pointer; }
.chat-send-as-btn:hover { color: var(--text); border-color: var(--text-muted); }
.chat-send-as-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.msg-sender-name { display: block; font-size: 0.75rem; color: var(--text-muted); margin-bottom: 0.2rem; }
/* Messages area: scrollable with max height */
.messages {
    padding: 1rem;
    min-height: 200px;
    max-height: calc(100vh - 220px);
    max-height: calc(100dvh - 220px);
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    direction: ltr;
}
.chat-messages-loading {
    display: -webkit-box;
    display: flex;
    -webkit-box-pack: center;
    -webkit-justify-content: center;
    justify-content: center;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
    padding: 1.75rem 1rem 2.25rem;
    min-height: 180px;
    min-height: min(200px, 38vh);
}
.chat-messages-loading-inner {
    display: -webkit-box;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-flex-direction: column;
    flex-direction: column;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
    gap: 0.75rem;
    text-align: center;
    max-width: 16rem;
}
.chat-messages-loading .loader.reconnect-heart-loader {
    margin: 0;
}
.chat-messages-loading-text {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
    line-height: 1.35;
}
.msg {
    display: flex;
    align-items: flex-end;
    gap: 0.4rem;
    margin-bottom: 0.5rem;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}
.msg.msg-failed { opacity: 0.85; }
.msg.msg-failed .msg-text { color: var(--text-muted); font-size: 0.85rem; }
.msg.msg-failed { cursor: pointer; }
/* mine: DOM avatar → stack → visual [bubble][avatar], cluster flush right */
.msg.mine {
    flex-direction: row-reverse;
    justify-content: flex-start;
}
.msg.mine::after {
    content: '';
    flex: 1 1 0;
    min-width: 0;
    order: 1;
}
/* theirs: DOM avatar → stack → visual [avatar][bubble], cluster flush left */
.msg.theirs {
    flex-direction: row;
    justify-content: flex-start;
}
.msg.theirs::after {
    content: '';
    flex: 1 1 0;
    min-width: 0;
    order: 999;
}
.msg-avatar { flex-shrink: 0; width: 32px; height: 32px; min-width: 32px; min-height: 32px; border-radius: 50%; overflow: hidden; }
.msg-avatar-img { width: 32px; height: 32px; min-width: 32px; min-height: 32px; object-fit: cover; background: var(--border); display: block; border-radius: 50%; }
.msg-stack {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    max-width: min(85%, 720px);
    min-width: 0;
    width: fit-content;
}
@media (min-width: 900px) {
    .msg-stack { max-width: min(65%, 720px); }
}
.msg.mine .msg-stack {
    align-items: flex-end;
    max-width: min(82%, 520px);
}
@media (min-width: 900px) {
    .msg.mine .msg-stack { max-width: min(58%, 480px); }
}
.msg-body {
    max-width: 100%;
    padding: 0.5rem 0.75rem;
    border-radius: 16px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    position: relative;
}
.msg.mine .msg-body { background: var(--primary); color: #fff; border-bottom-right-radius: 4px; word-break: break-word; }
.msg.theirs .msg-body { background: var(--surface); border: 1px solid var(--border); border-bottom-left-radius: 4px; word-break: break-word; }

.chat-replying-to {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
    padding: 0.45rem 0.65rem;
    border-radius: 10px;
    background: var(--bg);
    border: 1px solid var(--border);
    font-size: 0.9rem;
}
.chat-replying-to.hidden { display: none !important; }
.chat-replying-to-label { color: var(--text-muted); flex-shrink: 0; }
.chat-replying-to-preview {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-style: italic;
}
.chat-replying-to-cancel {
    flex-shrink: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 0.2rem 0.4rem;
    border-radius: 6px;
    font-size: 1rem;
    line-height: 1;
    color: var(--text-muted);
}
.chat-replying-to-cancel:hover { background: var(--surface); color: var(--text); }

.msg-reply-quote {
    display: block;
    margin-bottom: 0.4rem;
    padding: 0.35rem 0.5rem;
    border-left: 3px solid rgba(255, 255, 255, 0.45);
    font-size: 0.85rem;
    opacity: 0.92;
    cursor: pointer;
    border-radius: 0 6px 6px 0;
    text-align: left;
    width: 100%;
    background: rgba(0, 0, 0, 0.12);
    color: inherit;
    font-family: inherit;
}
.msg.theirs .msg-reply-quote {
    border-left-color: var(--primary);
    background: rgba(233, 30, 99, 0.08);
}
.msg-footer-row {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: flex-start;
    gap: 0.15rem 0.4rem;
    margin-top: 0.1rem;
    font-size: 0.65rem;
    line-height: 1.2;
}
.msg.mine .msg-footer-row { justify-content: flex-start; }
.msg-body-actions {
    margin-top: 0.2rem;
    padding-top: 0.28rem;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.2rem;
    width: 100%;
    box-sizing: border-box;
    position: relative;
}
.msg.mine .msg-body-actions {
    border-top-color: rgba(255, 255, 255, 0.22);
}
.msg.theirs .msg-body-actions {
    border-top-color: var(--border);
}
.msg-body .msg-actions {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem;
}
.msg-time {
    font-size: 0.65rem;
    opacity: 0.88;
    display: inline;
    margin: 0;
    flex-shrink: 0;
    white-space: nowrap;
}
.msg.mine .msg-time { color: rgba(255, 255, 255, 0.88); }
.msg-body .msg-reply-btn,
.msg-body .msg-delete,
.msg-body .msg-react-add {
    font-size: 0.65rem;
    padding: 0;
    margin: 0;
    border: none;
    border-radius: 0;
    background: transparent;
    cursor: pointer;
    font-family: inherit;
    line-height: 1.25;
    text-decoration: underline;
    text-underline-offset: 2px;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    opacity: 0.92;
}
.msg.mine .msg-body .msg-reply-btn,
.msg.mine .msg-body .msg-delete,
.msg.mine .msg-body .msg-react-add {
    color: rgba(255, 255, 255, 0.9);
}
.msg.theirs .msg-body .msg-reply-btn,
.msg.theirs .msg-body .msg-delete,
.msg.theirs .msg-body .msg-react-add {
    color: var(--text-muted);
}
.msg-body .msg-reply-btn:hover,
.msg-body .msg-delete:hover,
.msg-body .msg-react-add:hover { opacity: 1; }

.msg-reactions-row {
    margin-top: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.14rem 0.18rem;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    justify-content: flex-start;
    position: relative;
}
.msg-body .msg-reaction-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.1rem;
    font-size: 0.68rem;
    padding: 0.02rem 0.28rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--bg);
    cursor: pointer;
    font-family: inherit;
    line-height: 1.15;
    min-height: 0;
    color: var(--text);
}
.msg.mine .msg-body .msg-reaction-chip {
    border-color: rgba(255, 255, 255, 0.4);
    background: rgba(0, 0, 0, 0.12);
    color: #fff;
}
.msg.mine .msg-body .msg-reaction-chip.mine {
    border-color: rgba(255, 255, 255, 0.65);
    background: rgba(255, 255, 255, 0.18);
}
.msg.theirs .msg-body .msg-reaction-chip.mine {
    border-color: var(--primary);
    background: rgba(233, 30, 99, 0.1);
}
.msg-reaction-count { font-size: 0.62rem; opacity: 0.9; font-weight: 600; }
.msg-reaction-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 0.2rem;
    margin-top: 0;
    padding: 0.35rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface);
    max-width: min(240px, 70vw);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    position: absolute;
    top: calc(100% + 4px);
    z-index: 40;
}
.msg-body .msg-reaction-picker { left: 0; right: auto; }
.msg-reaction-picker.hidden { display: none !important; }
.msg-reaction-picker .chat-emoji-item { font-size: 1.1rem; padding: 0.2rem; }

.msg-highlight {
    animation: msg-highlight-pulse 1.2s ease-out;
}
@keyframes msg-highlight-pulse {
    0% { box-shadow: 0 0 0 0 rgba(233, 30, 99, 0.55); }
    100% { box-shadow: 0 0 0 12px transparent; }
}
.msg-text a { color: inherit; text-decoration: underline; }
.msg.mine .msg-text a { color: rgba(255,255,255,0.95); }
.chat-typing-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    width: 100%;
    box-sizing: border-box;
    justify-content: flex-start;
}
.chat-typing-indicator .msg-avatar-img { width: 32px; height: 32px; }
.chat-typing-dots { display: flex; gap: 4px; padding: 0.5rem 0.75rem; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; border-bottom-left-radius: 4px; }
.chat-typing-dots span { width: 6px; height: 6px; border-radius: 50%; background: var(--text-muted); -webkit-animation: chat-typing-bounce 1.2s ease-in-out infinite; animation: chat-typing-bounce 1.2s ease-in-out infinite; }
.chat-typing-dots span:nth-child(2) { -webkit-animation-delay: 0.15s; animation-delay: 0.15s; }
.chat-typing-dots span:nth-child(3) { -webkit-animation-delay: 0.3s; animation-delay: 0.3s; }
@-webkit-keyframes chat-typing-bounce { 0%, 60%, 100% { -webkit-transform: translateY(0); } 30% { -webkit-transform: translateY(-4px); } }
@keyframes chat-typing-bounce { 0%, 60%, 100% { transform: translateY(0); } 30% { transform: translateY(-4px); } }
.composer-drag-over { outline: 2px dashed var(--primary); outline-offset: -2px; background: rgba(233, 30, 99, 0.06); }
.composer { flex-shrink: 0; padding: .5rem 1rem; padding-left: max(1rem, var(--safe-left)); padding-right: max(1rem, var(--safe-right)); padding-bottom: max(0.5rem, var(--safe-bottom)); background: var(--surface); border-top: 1px solid var(--border); }
.composer-quick { margin-bottom: .35rem; display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; }
.composer-emoji-btn, .composer-attach-btn { padding: .35rem .5rem; font-size: 1.2rem; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); cursor: pointer; line-height: 1; }
.composer-emoji-btn:hover, .composer-attach-btn:hover { background: var(--surface); }
/* Visually hidden so programmatic .click() works on iOS/Android (hidden attribute blocks file picker) */
.chat-attach-input-hidden { position: absolute; width: 0; height: 0; opacity: 0; overflow: hidden; clip: rect(0,0,0,0); }
.chat-emoji-picker { display: grid; grid-template-columns: repeat(10, 1fr); gap: .25rem; padding: .5rem; margin-bottom: .5rem; max-height: 160px; overflow-y: auto; background: var(--bg); border: 1px solid var(--border); border-radius: 12px; }
.chat-emoji-picker.hidden { display: none; }
.chat-emoji-item { padding: .35rem; min-width: 44px; min-height: 44px; font-size: 1.25rem; border: none; border-radius: 6px; background: transparent; cursor: pointer; line-height: 1; display: inline-flex; align-items: center; justify-content: center; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.chat-emoji-item:hover, .chat-emoji-item:active { background: var(--surface); }
.quick-consent { font-size: .75rem; padding: .25rem .5rem; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; color: var(--text-muted); cursor: pointer; }
.quick-consent:hover { border-color: var(--primary); color: var(--primary); }
.composer-input-wrap { display: flex; gap: .5rem; align-items: flex-end; }
.composer textarea { flex: 1; padding: .6rem .8rem; border: 1px solid var(--border); border-radius: 20px; resize: none; min-height: 40px; max-height: 100px; font-family: inherit; font-size: 16px; }
.composer .send-btn { flex-shrink: 0; }
.composer .send-btn { width: 40px; height: 40px; border-radius: 50%; background: var(--primary); color: #fff; border: none; cursor: pointer; font-size: 1.1rem; flex-shrink: 0; }
.msg img.media { max-width: 100%; max-height: 280px; border-radius: 8px; cursor: pointer; display: block; }
.msg img.media.reconnect-media-loading,
.msg video.media.reconnect-media-loading { min-height: 100px; min-width: 80px; background: var(--border); }
.msg video.media.chat-video { max-width: 100%; max-height: 240px; border-radius: 8px; }
/* Chat image modal */
/* Stories bar */
.stories-bar { display: flex; gap: .5rem; padding: .5rem 1rem; overflow-x: auto; background: var(--surface); border-bottom: 1px solid var(--border); }
.story-ring { flex: 0 0 56px; height: 56px; border-radius: 50%; background: var(--match-bg); display: flex; align-items: center; justify-content: center; color: #fff; font-size: .8rem; cursor: pointer; }

/* Games */
.games-grid { display: grid; gap: 1rem; margin-top: 1rem; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.games-panel-bottom { padding-bottom: 2rem; }

/* Games — customize panel: airy sections, soft surfaces, chip toggles */
.games-customize-panel {
    margin-top: 1.5rem;
    border: none;
    border-radius: 20px;
    padding: 0;
    background: transparent;
    box-shadow: none;
}
.games-customize-summary {
    cursor: pointer;
    list-style: none;
    font-weight: 600;
    font-size: 1rem;
    letter-spacing: -0.01em;
    padding: 0.85rem 1.1rem;
    border-radius: 16px;
    background: var(--surface);
    border: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
    display: flex;
    align-items: center;
    gap: 0.65rem;
    transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.games-customize-summary:hover {
    border-color: color-mix(in srgb, var(--primary) 28%, var(--border));
    background: color-mix(in srgb, var(--surface) 92%, var(--primary));
}
.games-customize-panel[open] .games-customize-summary {
    border-radius: 16px 16px 0 0;
    border-bottom-color: transparent;
    box-shadow: none;
}
.games-customize-summary::-webkit-details-marker { display: none; }
.games-customize-summary::before {
    content: '';
    flex-shrink: 0;
    width: 0.45rem;
    height: 0.45rem;
    border-right: 2px solid var(--text-muted);
    border-bottom: 2px solid var(--text-muted);
    transform: rotate(-45deg);
    margin-top: -0.2rem;
    opacity: 0.75;
    transition: transform 0.2s ease;
}
.games-customize-panel[open] .games-customize-summary::before {
    transform: rotate(45deg);
    margin-top: 0.15rem;
}
.games-customize-inner {
    padding: 1.5rem 1.25rem 1.75rem;
    border: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
    border-top: none;
    border-radius: 0 0 20px 20px;
    background: color-mix(in srgb, var(--surface) 96%, var(--bg));
    display: flex;
    flex-direction: column;
    gap: 2rem;
}
.games-custom-intro {
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.55;
    color: var(--text-muted);
    max-width: 52ch;
}
.games-custom-section {
    margin: 0;
    padding: 0;
    border: none;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}
.games-custom-section + .games-custom-section {
    padding-top: 1.75rem;
    border-top: 1px solid color-mix(in srgb, var(--border) 55%, transparent);
}
.games-custom-section-title {
    margin: 0;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.games-custom-section-lead {
    margin: -0.35rem 0 0;
    font-size: 0.88rem;
    line-height: 1.45;
    color: var(--text-muted);
}
.games-custom-mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.86em;
    font-weight: 500;
    color: var(--text);
}
.games-custom-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}
.games-custom-field--flush {
    gap: 0.45rem;
}
.games-custom-label {
    display: block;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text);
    margin: 0;
}
.games-custom-label--static {
    font-size: 0.95rem;
}
.games-custom-hint {
    font-size: 0.82rem;
    line-height: 1.4;
    color: var(--text-muted);
    margin: 0;
}
.games-custom-textarea,
.games-custom-input {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding: 0.75rem 1rem;
    border: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
    border-radius: 14px;
    font-size: 0.95rem;
    font-family: inherit;
    line-height: 1.45;
    background: var(--surface);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.games-custom-textarea:focus,
.games-custom-input:focus {
    outline: none;
    border-color: color-mix(in srgb, var(--primary) 45%, var(--border));
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent);
}
.games-custom-textarea { resize: vertical; min-height: 3.25rem; }
.games-custom-keys-hint {
    margin: 0.35rem 0 0;
    font-size: 0.78rem;
    line-height: 1.5;
    color: var(--text-muted);
}
.games-custom-keys-hint code {
    display: inline-block;
    margin: 0.15rem 0.35rem 0.15rem 0;
    padding: 0.12rem 0.4rem;
    font-size: 0.76rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    border-radius: 6px;
    background: color-mix(in srgb, var(--border) 35%, transparent);
    color: var(--text);
    border: none;
}
.games-hide-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.35rem;
}
.games-hide-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    margin: 0;
    padding: 0.45rem 0.85rem;
    font-size: 0.86rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: 999px;
    border: 1px solid color-mix(in srgb, var(--border) 75%, transparent);
    background: var(--surface);
    color: var(--text);
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
    user-select: none;
}
.games-hide-chip:hover {
    border-color: color-mix(in srgb, var(--primary) 35%, var(--border));
    background: color-mix(in srgb, var(--surface) 88%, var(--primary));
}
.games-hide-chip:has(input:checked) {
    border-color: color-mix(in srgb, var(--primary) 55%, var(--border));
    background: color-mix(in srgb, var(--primary) 14%, var(--surface));
    color: var(--primary-dark, var(--primary));
}
.games-hide-chip input {
    accent-color: var(--primary);
    width: 1rem;
    height: 1rem;
    margin: 0;
    flex-shrink: 0;
}
.games-custom-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.65rem 0.75rem;
    padding-top: 0.25rem;
}
.games-custom-btn {
    border-radius: 999px;
    padding-left: 1.25rem;
    padding-right: 1.25rem;
}
.games-custom-save-hint {
    margin: 0;
    flex: 1 1 12rem;
    min-width: 0;
}
.game-card { background: var(--surface); border-radius: 16px; padding: 1.25rem; border: 1px solid var(--border); cursor: pointer; text-align: center; }
.game-card h4 { margin: 0 0 .35rem; font-size: 1.1rem; }
.game-card p { margin: 0; font-size: .85rem; color: var(--text-muted); }
.prompt-card { background: var(--primary-light); color: var(--primary-dark); padding: 1rem; border-radius: 12px; margin: 1rem 0; }
.prompt-card .prompt-text { font-size: 1rem; font-weight: 500; }
.wyr-options { display: flex; gap: .5rem; margin-top: 1rem; flex-wrap: wrap; }
.wyr-options button { flex: 1; min-width: 120px; padding: .75rem; border-radius: 12px; border: 2px solid var(--border); background: var(--surface); cursor: pointer; font-size: .9rem; }
.wyr-options button:hover { border-color: var(--primary); color: var(--primary); }

/* Profile */
.profile-tabs { display: flex; gap: .25rem; padding: .5rem 1rem; border-bottom: 1px solid var(--border); background: var(--surface); }
.profile-tab { padding: .5rem 1rem; border: none; background: none; cursor: pointer; font-size: .9rem; color: var(--text-muted); border-radius: 8px; transition: background .2s, color .2s; }
.profile-tab:hover { color: var(--text); background: rgba(233, 30, 99, 0.08); }
.profile-tab.active { background: var(--primary); color: #fff; }

.profile-partner-selector { padding: 0.5rem 1rem; border-bottom: 1px solid var(--border); background: var(--surface-secondary, var(--surface)); }
.profile-partner-selector.hidden { display: none !important; }
.profile-partner-subtabs { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.profile-partner-sub { padding: 0.4rem 0.75rem; border: 1px solid var(--border); background: var(--surface); border-radius: 8px; cursor: pointer; font-size: 0.85rem; color: var(--text-muted); transition: background .2s, color .2s, border-color .2s; }
.profile-partner-sub:hover { color: var(--text); background: rgba(233, 30, 99, 0.08); border-color: var(--primary); }
.profile-partner-sub.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.profile-partner-personas-approve { padding: 1rem 1rem 0.5rem; border-bottom: 1px solid var(--border); background: var(--bg); }
.profile-partner-personas-approve.hidden { display: none !important; }
.profile-partner-personas-approve-title { margin: 0 0 0.25rem; font-size: 1rem; }
.profile-partner-personas-approve .kink-desc { margin: 0 0 0.75rem; font-size: 0.85rem; }
.profile-partner-personas-list { display: flex; flex-direction: column; gap: 0.5rem; }
.profile-partner-persona-row { display: flex; align-items: center; flex-wrap: wrap; gap: 0.5rem; padding: 0.6rem 0; border-bottom: 1px solid var(--border); }
.profile-partner-persona-row:last-child { border-bottom: none; }
.profile-partner-persona-name { flex: 1; min-width: 0; font-weight: 600; }
.profile-partner-persona-status { font-size: 0.85rem; color: var(--text-muted); }
.profile-partner-persona-actions { display: flex; gap: 0.5rem; }
.profile-partner-personas-empty { margin: 0.5rem 0; padding: 0.5rem 0; }

/* My profile edit — grid layout */
.profile-edit-wrap { padding: 1rem; padding-bottom: 2rem; }
.profile-edit-grid { display: grid; gap: 1.25rem; max-width: 100%; width: 100%; margin: 0 auto; }
@media (min-width: 640px) {
    .profile-edit-grid { grid-template-columns: 1fr 1fr; }
}
.profile-edit-card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 1.25rem; box-shadow: 0 2px 12px rgba(0,0,0,.04); transition: box-shadow .2s; }
.profile-edit-card:focus-within { box-shadow: 0 4px 20px rgba(233, 30, 99, 0.12); }
.profile-edit-card-full { grid-column: 1 / -1; }
.profile-edit-card-title { margin: 0 0 0.75rem; font-size: 1.05rem; font-weight: 600; color: var(--text); letter-spacing: 0.02em; }
.profile-edit-label { display: block; margin-bottom: 0.75rem; font-size: 0.9rem; }
.profile-edit-label:last-child { margin-bottom: 0; }
.profile-edit-input { width: 100%; padding: 0.6rem 0.75rem; margin-top: 0.25rem; border: 1px solid var(--border); border-radius: 10px; font-size: 0.95rem; background: var(--input-fill); color: var(--text); transition: border-color .2s, box-shadow .2s; }
.profile-edit-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(233, 30, 99, 0.15); }
.profile-edit-input::placeholder { color: var(--text-muted); opacity: 0.8; }
textarea.profile-edit-input { min-height: 80px; resize: vertical; }
select.profile-edit-select { cursor: pointer; min-height: 2.5rem; }
.profile-edit-actions { display: flex; justify-content: flex-start; align-items: center; }
.profile-hint { font-size: 0.85rem; color: var(--text-muted); margin: 0 0 0.75rem; line-height: 1.4; }
.profile-positions-heading { margin: 0 0 0.5rem; font-size: 1.05rem; font-weight: 600; color: var(--text); }
.profile-positions-cat { margin: 1rem 0; }
.profile-positions-cat:first-of-type { margin-top: 0; }
.profile-positions-cat h5 { margin: 0 0 0.5rem; font-size: 0.85rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.profile-position-cb { display: block; margin: 0.4rem 0; font-size: 0.9rem; cursor: pointer; padding: 0.25rem 0; }
.profile-position-cb input { margin-right: 0.5rem; accent-color: var(--primary); }

.profile-photos { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.edit-gallery-drop-zone { border: 2px dashed transparent; border-radius: 12px; padding: 0.5rem; transition: border-color .2s, background .2s; }
.edit-gallery-drop-zone.drag-over { border-color: var(--primary); background: rgba(233, 30, 99, 0.06); }
.explore-image-drop-zone { border: 2px dashed transparent; border-radius: 12px; padding: 0.5rem; transition: border-color .2s, background .2s; }
.explore-image-drop-zone.drag-over { border-color: var(--primary); background: rgba(233, 30, 99, 0.06); }
.profile-photos.edit-gallery { min-height: 80px; }
.profile-photos img { width: 100px; height: 100px; object-fit: cover; border-radius: 12px; box-shadow: 0 2px 8px rgba(0,0,0,.1); }
.profile-photos .gallery-item .reconnect-media-shell,
.profile-photos .gallery-item .reconnect-media-shell > img { width: 100px; height: 100px; border-radius: 12px; box-shadow: 0 2px 8px rgba(0,0,0,.1); }
.edit-gallery-empty-msg { margin: 0.5rem 0 0; max-width: 22rem; }
.gallery-item-generic-placeholder > img { object-fit: cover; border-radius: 12px; box-shadow: 0 2px 8px rgba(0,0,0,.1); }
.gallery-item { position: relative; display: inline-flex; flex-direction: column; align-items: center; }
.gallery-item .gallery-remove { position: absolute; top: 4px; right: 4px; width: 44px; height: 44px; min-width: 44px; min-height: 44px; border-radius: 50%; background: rgba(0,0,0,.65); color: #fff; border: none; cursor: pointer; font-size: 1.25rem; line-height: 1; display: flex; align-items: center; justify-content: center; transition: background .2s; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.gallery-item .gallery-remove:hover { background: rgba(0,0,0,.85); }
.gallery-item .gallery-main-label { font-size: 0.7rem; color: var(--primary); font-weight: 600; margin-top: 0.25rem; }
.gallery-item .gallery-set-main { margin-top: 0.25rem; padding: 0.25rem 0.5rem; font-size: 0.7rem; background: var(--primary); color: #fff; border: none; border-radius: 6px; cursor: pointer; white-space: nowrap; }
.gallery-item .gallery-set-main:hover { background: var(--primary-dark); }
.gallery-item-main .gallery-main-label { display: block; }

.alter-ego-gallery-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.75rem; }
.alter-ego-gallery-add-label { cursor: pointer; margin: 0; display: inline-block; }
.alter-ego-avatar-preview-wrap { display: flex; justify-content: center; margin: 0.75rem 0; }
.alter-ego-avatar-preview-img { width: 120px; height: 120px; border-radius: 50%; object-fit: cover; border: 2px solid var(--border); background: var(--surface); }
.profile-positions-list { min-height: 2rem; }
.profile-positions-list .profile-positions-cat { margin: 0.75rem 0; }
.likes-heading { font-size: 0.95rem; margin-top: 1rem; margin-bottom: 0.25rem; }
.alter-ego-positions-section { display: block !important; }
.alter-ego-image-choice { display: flex; gap: 1.5rem; margin-bottom: 1rem; }
.alter-ego-image-option { display: flex; align-items: center; gap: 0.4rem; cursor: pointer; font-size: 0.95rem; }
.alter-ego-image-option input { accent-color: var(--primary); }
.alter-ego-image-section { margin-top: 0.75rem; }

.avatar-picker-row { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 0.5rem; }
.avatar-picker-item { width: 56px; height: 56px; padding: 0; border: 2px solid var(--border); border-radius: 50%; overflow: hidden; background: var(--surface); cursor: pointer; flex-shrink: 0; transition: border-color .2s, box-shadow .2s; display: flex; align-items: center; justify-content: center; }
.avatar-picker-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-picker-item .reconnect-media-shell { width: 100%; height: 100%; border-radius: 50%; }
.avatar-picker-item .reconnect-media-shell > img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.alter-ego-avatar-preview-wrap .reconnect-media-shell { width: 120px; height: 120px; margin: 0 auto; border-radius: 50%; }
.alter-ego-avatar-preview-wrap .reconnect-media-shell > img { width: 120px; height: 120px; border-radius: 50%; object-fit: cover; border: 2px solid var(--border); background: var(--surface); }
.avatar-picker-item:hover { border-color: var(--primary); }
.avatar-picker-item-selected { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary); }
.alter-ego-picture-actions-hint { font-size: 0.85rem; color: var(--text-muted); margin: 0.5rem 0 0.75rem; line-height: 1.4; }
.alter-ego-picture-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.5rem; }

.media-gallery-modal { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 1rem; box-sizing: border-box; }
.media-gallery-modal.hidden { display: none; }
.media-gallery-modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.5); cursor: pointer; }
.media-gallery-modal-content { position: relative; background: var(--surface); border-radius: 16px; padding: 1.25rem; max-width: 420px; width: 100%; max-height: 85vh; overflow: auto; box-shadow: 0 8px 32px rgba(0,0,0,.2); }
.media-gallery-modal-title { margin: 0 0 0.35rem; font-size: 1.15rem; font-weight: 600; color: var(--text); }
.media-gallery-modal-content .profile-hint { margin-bottom: 0.75rem; }
.media-gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 0.5rem; margin-bottom: 1rem; }
.media-gallery-pick { width: 100%; aspect-ratio: 1; border: 2px solid var(--border); border-radius: 12px; background-size: cover; background-position: center; background-repeat: no-repeat; cursor: pointer; transition: border-color .2s, box-shadow .2s; min-height: 80px; padding: 0; overflow: hidden; position: relative; }
.media-gallery-pick img { width: 100%; height: 100%; object-fit: cover; display: block; min-height: 80px; }
.media-gallery-pick.reconnect-media-shell { position: relative; overflow: hidden; }
.media-gallery-pick.reconnect-media-shell .reconnect-media-shell-overlay { border-radius: 10px; }
.media-gallery-pick:hover { border-color: var(--primary); box-shadow: 0 2px 12px rgba(233, 30, 99, 0.2); }

.edit-profile-btn { display: inline-block; margin-top: 1rem; padding: .5rem 1rem; background: var(--primary); color: #fff; border: none; border-radius: 8px; cursor: pointer; text-decoration: none; font-size: .9rem; }

/* Partner profile view */
.profile-view-wrap { padding: 0 1rem 2rem 1rem; min-height: 200px; text-align: center; display: flex; flex-direction: column; align-items: center; }
.profile-view { padding-bottom: 0; width: 100%; max-width: 100%; margin: 0 auto; }
.profile-view-hero { position: relative; margin: 0 auto 1.5rem; overflow: hidden; border-radius: 0 0 24px 24px; background: linear-gradient(145deg, rgba(233, 30, 99, 0.06) 0%, var(--surface) 100%); max-width: 100%; width: 100%; }
.profile-view-photos { display: flex; gap: 0.5rem; overflow-x: auto; padding: 1rem; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; min-height: 200px; justify-content: center; }
.profile-view-photos img { width: 160px; min-width: 160px; height: 200px; object-fit: cover; border-radius: 14px; scroll-snap-align: start; box-shadow: 0 4px 16px rgba(0,0,0,.12); }
.profile-view-photo-wrap { position: relative; flex-shrink: 0; width: 160px; min-width: 160px; scroll-snap-align: start; }
.profile-view-photo-wrap .profile-view-photo-img { width: 160px; min-width: 160px; height: 200px; object-fit: cover; border-radius: 14px; box-shadow: 0 4px 16px rgba(0,0,0,.12); display: block; }
.profile-view-photo-loading { position: absolute; top: 0; right: 0; bottom: 0; left: 0; display: none; -webkit-box-orient: vertical; -webkit-box-direction: normal; -webkit-flex-direction: column; flex-direction: column; -webkit-box-pack: center; -webkit-box-align: center; -webkit-align-items: center; align-items: center; -webkit-justify-content: center; justify-content: center; gap: 0.4rem; text-align: center; font-size: 0.78rem; font-weight: 500; line-height: 1.3; color: #fff; background: rgba(0,0,0,.45); border-radius: 14px; padding: 0.5rem; z-index: 1; pointer-events: none; }
.profile-view-photo-loading .loader.reconnect-heart-loader { margin: 0; width: 48px; height: 48px; }
.profile-view-photo-loading .reconnect-heart-loader-track { stroke: rgba(255,255,255,.35); }
.profile-view-photo-loading .reconnect-heart-loader-active { stroke: #fff; }
.profile-view-photo-loading-text { max-width: 7rem; }
.profile-view-photo-img.reconnect-media-loading + .profile-view-photo-loading { display: -webkit-box; display: flex; }
.profile-view-photo-wrap:has(.profile-view-photo-img.reconnect-media-loading) .profile-view-photo-loading { display: -webkit-box; display: flex; }
.profile-view-photos img.profile-view-avatar-placeholder { width: 160px; min-width: 160px; height: 200px; object-fit: cover; border-radius: 14px; background: var(--surface); }
.profile-view-photos-empty { min-width: 100%; min-height: 180px; display: flex; align-items: center; justify-content: center; color: var(--text-muted); font-size: 0.95rem; background: var(--surface); border: 2px dashed var(--border); border-radius: 14px; margin: 0 1rem; }
.profile-view-header { padding: 1rem 1.25rem 1.25rem; text-align: center; }
.profile-view-name { margin: 0 0 0.25rem; font-size: 1.6rem; font-weight: 700; color: var(--text); letter-spacing: -0.02em; line-height: 1.2; }
.profile-view-tagline { margin: 0; font-size: 1rem; color: var(--primary); font-weight: 500; }
.profile-view-grid { display: grid; gap: 1rem; padding: 0; max-width: 100%; width: 100%; margin: 0 auto; }
@media (min-width: 560px) {
    .profile-view-grid { grid-template-columns: 1fr 1fr; }
}
.profile-view-card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 1.25rem; box-shadow: 0 2px 12px rgba(0,0,0,.04); text-align: center; }
.profile-view-card-full { grid-column: 1 / -1; }
.profile-view-card-title { margin: 0 0 0.75rem; font-size: 0.9rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.profile-view-text { margin: 0 0 0.6rem; font-size: 0.95rem; line-height: 1.5; color: var(--text); }
.profile-view-text:last-child { margin-bottom: 0; }
.profile-view-meta { margin: 0.5rem 0 0; font-size: 0.9rem; color: var(--text-muted); }
.profile-view-tags { display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: center; }
.profile-view-tag { display: inline-block; padding: 0.35rem 0.75rem; background: rgba(233, 30, 99, 0.12); color: var(--primary); border-radius: 999px; font-size: 0.85rem; font-weight: 500; }
.profile-view-empty { margin: 0; color: var(--text-muted); font-size: 0.95rem; text-align: center; padding: 1rem; }

/* Settings */
.settings-list { list-style: none; padding: 0; margin: 0; }
.settings-list li { padding: .85rem 1rem; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.5rem; }
.settings-list a { color: var(--text); text-decoration: none; }
.settings-list .logout { color: var(--primary); font-weight: 500; }
.profile-settings-wrap .settings-list li { align-items: flex-start; }
.profile-settings-wrap .settings-list li > span { flex-shrink: 0; font-weight: 600; }
#btn-invite-partner:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}
.settings-subsection .kink-game-btn { margin-top: 0.25rem; }
.settings-media-stats { margin: 0.35rem 0; }
.settings-media-list { margin: 0.5rem 0; }
.settings-media-items { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 0.75rem; }
.settings-media-item { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--bg-alt, #f8f8f8); }
.settings-media-thumb { position: relative; width: 100%; aspect-ratio: 1; background: var(--border); overflow: hidden; cursor: pointer; }
.settings-media-thumb .reconnect-media-shell { position: absolute; top: 0; right: 0; bottom: 0; left: 0; width: 100%; height: 100%; }
.settings-media-thumb .reconnect-media-shell > img,
.settings-media-thumb .reconnect-media-shell > video { width: 100%; height: 100%; object-fit: cover; display: block; }
.settings-media-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.settings-media-thumb.thumb-error { background: var(--text-muted, #999); }
.settings-media-thumb.thumb-error img { display: none; }
.settings-media-thumb.thumb-error::after { content: '?'; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; color: #fff; }
.settings-media-thumb-video { display: flex; align-items: center; justify-content: center; }
.settings-media-thumb-video video { width: 100%; height: 100%; object-fit: cover; }
.settings-media-play-icon { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 2rem; color: rgba(255,255,255,0.9); text-shadow: 0 1px 3px rgba(0,0,0,0.5); pointer-events: none; }
.settings-media-thumb-audio { display: flex; align-items: center; justify-content: center; }
.settings-media-audio-icon { font-size: 2rem; color: var(--text-muted); }
.settings-media-item-info { padding: 0.4rem 0.5rem; display: flex; flex-direction: column; gap: 0.25rem; }
.settings-media-item-info .settings-media-meta { font-size: 0.8rem; color: var(--text-muted); }
.settings-media-item-info .settings-media-delete { align-self: flex-start; padding: 0.25rem 0.5rem; font-size: 0.85rem; }

/* Explore */
.idea-card { background: var(--surface); border-radius: 12px; padding: 1rem; margin-bottom: .5rem; border: 1px solid var(--border); }
.idea-card .category { font-size: .75rem; color: var(--primary); text-transform: uppercase; margin-bottom: .25rem; }
.partner-asks-wishes-read { margin: 0.75rem 0 1rem; padding: 1rem; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); }
.partner-asks-wishes-label { font-size: 0.8rem; font-weight: 600; color: var(--primary); margin: 0 0 0.5rem; }
.partner-asks-wishes-body { font-size: 0.95rem; line-height: 1.5; white-space: pre-wrap; word-break: break-word; margin: 0; }
.explore-ideas-details summary { user-select: none; }

.stories-tagline { font-size: .9rem; color: var(--text-muted); margin: 0 0 1rem; }
.stories-actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.stories-literotica-bar { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; margin-bottom: 1rem; padding: .5rem 0; }
.stories-literotica-link { color: var(--primary); text-decoration: none; font-weight: 600; }
.stories-literotica-link:hover { text-decoration: underline; }
.stories-categories-tabs { display: flex; gap: .35rem; flex-wrap: wrap; margin-bottom: 1rem; }
.stories-categories-tabs button { padding: .4rem .75rem; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); font-size: .85rem; cursor: pointer; }
.stories-categories-tabs button.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.stories-list { padding: 0; }
.stories-empty { padding: 1rem; text-align: center; color: var(--text-muted); }
.story-card { background: var(--surface); border-radius: 12px; padding: 1rem; margin-bottom: .75rem; border: 1px solid var(--border); }
.story-card-header { display: flex; justify-content: space-between; align-items: flex-start; gap: .5rem; margin-bottom: .5rem; }
.story-card-title { font-weight: 600; margin: 0; font-size: 1rem; }
.story-card-meta { font-size: .8rem; color: var(--text-muted); margin-bottom: .5rem; }
.story-card-content { font-size: .9rem; line-height: 1.5; white-space: pre-wrap; word-break: break-word; max-height: 120px; overflow: hidden; }
.story-card-content.expanded { max-height: none; }
.story-card-actions { margin-top: .5rem; display: flex; gap: .35rem; flex-wrap: wrap; }
.story-card-actions button { padding: .25rem .5rem; font-size: .8rem; border-radius: 6px; border: 1px solid var(--border); background: var(--bg); cursor: pointer; }
.story-move-select, .story-move-ok { margin-left: .25rem; font-size: .8rem; }
.story-card-url { display: inline-block; margin-top: .35rem; color: var(--primary); font-size: .85rem; word-break: break-all; }
.stories-form-wrap { background: var(--surface); border-radius: 12px; padding: 1rem; margin: 1rem 0; border: 1px solid var(--border); }
.stories-form-wrap label { display: block; margin-top: .75rem; }
.stories-form-wrap input, .stories-form-wrap select, .stories-form-wrap textarea { width: 100%; margin-top: .25rem; }

/* Tap / Compliment */
.tap-btn { padding: .75rem 1.5rem; background: var(--primary); color: #fff; border: none; border-radius: 12px; font-weight: 600; cursor: pointer; margin: .5rem 0; }
.tap-btn:disabled { opacity: .6; cursor: not-allowed; }

/* Desires & Kinks panel */
.desires-content { padding: 0 .5rem; }
.kink-section { margin: 1.25rem 0; padding-bottom: 1rem; border-bottom: 1px solid var(--border); }
.kink-section:last-of-type { border-bottom: none; }
.kink-section h4 { margin: 0 0 .5rem; font-size: 1rem; color: var(--text); }
#sub-share-rows { margin-top: 0.75rem; }
.sub-share-row { margin: 1rem 0; padding: 0.75rem; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-elevated, rgba(0,0,0,0.03)); }
.sub-share-row h5 { margin: 0 0 0.5rem; font-size: 0.92rem; color: var(--text); }
.sub-share-row-toolbar { margin-bottom: 0.5rem; }
.sub-share-row-toolbar-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.25rem;
}
.sub-share-row-toolbar-inner .sub-name { flex: 1 1 160px; min-width: 0; }
.sub-share-row-toolbar-inner .sub-share-rename,
.sub-share-row-toolbar-inner .sub-share-delete { flex: 0 0 auto; white-space: nowrap; }
.sub-share-name-label { display: block; font-size: 0.78rem; font-weight: 600; color: var(--text-muted); margin: 0; }
.sub-share-row label:not(.sub-share-name-label) { display: block; font-size: 0.78rem; font-weight: 600; color: var(--text-muted); margin: 0.4rem 0 0.2rem; }
.sub-share-row input { width: 100%; max-width: 100%; box-sizing: border-box; padding: 0.45rem 0.55rem; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-size: 0.9rem; }
.subscription-shares-form #subscription-shares-add { margin-top: 0.25rem; }
.subscription-shares-form .kink-game-btn { margin-top: 0.75rem; }

.toy-share-board-form h5 { margin: 0 0 0.35rem; font-size: 0.95rem; color: var(--text); }
.toy-share-board-form .toy-link-row {
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}
.toy-share-board-form .toy-link-row:last-of-type { border-bottom: none; }
.toy-share-board-form .toy-link-row label { display: block; font-size: 0.8rem; margin-top: 0.35rem; color: var(--text-muted, #888); }
.toy-share-board-form .toy-link-row input[type="url"],
.toy-share-board-form .toy-link-row input[type="text"] { width: 100%; box-sizing: border-box; margin-top: 0.15rem; }
.toy-share-board-form #toy-board-add-link { margin-top: 0.5rem; }
.toy-board-photo-item {
    display: grid;
    grid-template-columns: 88px 1fr auto;
    gap: 0.5rem;
    align-items: start;
    margin-bottom: 0.75rem;
    padding: 0.5rem;
    background: var(--surface-elevated, rgba(0,0,0,0.04));
    border-radius: 8px;
}
.toy-board-photo-item img {
    width: 88px;
    height: 88px;
    object-fit: cover;
    border-radius: 6px;
    background: var(--border);
}
.toy-board-photo-item textarea { width: 100%; min-height: 3rem; box-sizing: border-box; resize: vertical; }
.toy-board-photo-item .toy-board-remove-photo { align-self: center; }
.toy-board-file-label { display: inline-block; margin: 0.5rem 0 0.75rem; cursor: pointer; }
.toy-board-file-label input { position: absolute; width: 0; height: 0; opacity: 0; }
.partner-toy-board-block { margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.partner-toy-board-block .partner-toy-thumb { max-width: 120px; max-height: 120px; border-radius: 6px; object-fit: cover; margin: 0.25rem 0.5rem 0.25rem 0; vertical-align: top; }
.partner-toy-board-block .partner-toy-ref-img { max-width: 160px; max-height: 120px; border-radius: 6px; object-fit: contain; margin-top: 0.35rem; display: block; }
.kink-desc, .glossary-hint { font-size: .85rem; color: var(--text-muted); margin: .35rem 0; }
.tag-list { display: flex; flex-wrap: wrap; gap: .4rem; margin: .5rem 0; min-height: 2.5rem; }
.tag-pill { display: inline-block; padding: .35rem .65rem; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); font-size: .85rem; cursor: pointer; user-select: none; color: var(--text); -webkit-tap-highlight-color: transparent; }
.tag-pill.selected { background: var(--primary); color: #fff; border-color: var(--primary); }
.tag-pill.constellation-pill { background: var(--primary-light); border-color: var(--primary); color: var(--primary-dark); }
.tag-pill-custom { display: inline-flex; align-items: center; gap: 0.25rem; padding-right: 0.25rem; }
.tag-pill-remove { margin: 0; padding: 0 0.35rem; font-size: 1.1rem; line-height: 1; background: none; border: none; color: inherit; opacity: 0.85; cursor: pointer; border-radius: 4px; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.tag-pill-remove:hover { opacity: 1; background: rgba(0,0,0,0.15); }
.tag-pill.selected .tag-pill-remove:hover { background: rgba(255,255,255,0.25); }
.kink-custom-tag-label { display: block; font-size: .8rem; font-weight: 600; margin: 0.65rem 0 0.25rem; color: var(--text); }
.kink-custom-tag-desc { width: 100%; max-width: 100%; box-sizing: border-box; margin-top: 0; margin-bottom: 0.35rem; padding: 0.5rem 0.65rem; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-size: 0.9rem; resize: vertical; min-height: 2.5rem; }
#custom-tag-desc { width: 400px; max-width: 100%; }
.glossary-user-note em, .glossary-general em { font-style: normal; font-weight: 600; color: var(--text-muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; }
.glossary-popup .text-muted { color: var(--text-muted); font-size: 0.9rem; }
#desires-tag-list { visibility: visible; opacity: 1; min-height: min(22rem, 55vh); padding: 0.65rem 0.5rem 0.85rem; align-content: flex-start; gap: 0.5rem !important; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); box-sizing: border-box; }
#desires-tag-list.desires-tag-list-loading {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: center;
    align-content: center;
    gap: 0;
}
.desires-tag-list-loading-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    padding: 1.25rem 1rem;
    color: var(--text-muted);
    text-align: center;
}
.desires-tag-list-loading-inner .loader.reconnect-heart-loader { margin: 0; }
.desires-tag-list-loading-text { font-size: 0.9rem; font-weight: 500; }
p.desires-tag-list-load-hint { margin: 0; padding: 1rem 0.75rem; text-align: center; font-size: 0.9rem; }
.glossary-tooltip { position: fixed; z-index: 260; max-width: min(28rem, calc(100vw - 1.5rem)); max-height: min(22rem, 50vh); overflow-y: auto; padding: 0.85rem 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); font-size: 0.88rem; line-height: 1.45; pointer-events: auto; -webkit-overflow-scrolling: touch; }
.glossary-tooltip.hidden { display: none !important; pointer-events: none !important; }
.glossary-tooltip-inner .glossary-tooltip-title { display: block; margin-bottom: 0.5rem; font-size: 0.95rem; }
.glossary-tooltip-section { margin-top: 0.5rem; }
.glossary-tooltip-section p { margin: 0.25rem 0 0; }
.glossary-tooltip-label { display: block; font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); margin-bottom: 0.15rem; }
.glossary-tooltip-fallback, .glossary-tooltip-muted { margin: 0.35rem 0 0; color: var(--text-muted); }
.dislikes-tag-list { margin-top: 0.5rem; }
.dislikes-tag-input { margin-top: 0.5rem; max-width: 100%; }
.dislike-pill { display: inline-flex; align-items: center; gap: 0.35rem; padding-right: 0.35rem; }
.dislike-pill-remove { margin: 0; padding: 0 0.2rem; font-size: 1.1rem; line-height: 1; background: none; border: none; color: var(--text-muted); cursor: pointer; border-radius: 4px; }
.dislike-pill-remove:hover { color: var(--text); background: rgba(0,0,0,.06); }
.profile-view-tag-dislike { background: rgba(0,0,0,.06); color: var(--text-muted); border: 1px solid var(--border); }
.profile-view-tags-dislikes { margin-top: 0.25rem; }
.kink-score-msg { font-size: 1.1rem; font-weight: 600; color: var(--primary); margin: .5rem 0; }
.constellation-tags { margin-top: .5rem; }
#custom-tag-input { width: 100%; max-width: 240px; padding: .5rem; margin: .5rem 0; border: 1px solid var(--border); border-radius: 8px; }
#desires-save, #btn-reflections, #btn-boundaries, #btn-kink-ping { margin-top: .5rem; padding: .5rem 1rem; background: var(--primary); color: #fff; border: none; border-radius: 8px; cursor: pointer; font-size: .9rem; }
#btn-lock-kinks.secondary { background: var(--border); color: var(--text); }
.partner-notify { background: var(--primary-light); color: var(--primary-dark); padding: .75rem; border-radius: 8px; margin-bottom: 1rem; }
.partner-notify a { color: var(--primary-dark); font-weight: 600; }
.kink-pin-gate { padding: 2rem 1rem; text-align: center; }
.kink-pin-gate input { padding: .5rem; margin: .5rem; max-width: 160px; }
.kink-pin-gate button { padding: .5rem 1rem; background: var(--primary); color: #fff; border: none; border-radius: 8px; cursor: pointer; }
.reflections-form label, .boundaries-form label { display: block; margin: .75rem 0; }
.reflections-form textarea, .boundaries-form textarea { width: 100%; padding: .5rem; border: 1px solid var(--border); border-radius: 8px; margin-top: .25rem; }
#reflections-save, #boundaries-save { margin-top: .5rem; padding: .5rem 1rem; background: var(--primary); color: #fff; border: none; border-radius: 8px; cursor: pointer; }
.glossary-popup { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); max-width: 90%; width: 320px; background: var(--surface); padding: 1.25rem; border-radius: 12px; box-shadow: var(--shadow); z-index: 300; border: 1px solid var(--border); }
.glossary-popup p { margin: .75rem 0 0; font-size: .9rem; line-height: 1.4; }
.glossary-close { margin-top: 1rem; padding: .4rem .8rem; background: var(--border); border: none; border-radius: 6px; cursor: pointer; }

/* ImageViewer / Lightbox — site-wide; tap/click to enlarge; pinch/scroll zoom; swipe or click outside to close */
.media-lightbox { position: fixed; inset: 0; z-index: 350; background: rgba(0,0,0,.88); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); display: flex; align-items: center; justify-content: center; padding: 2rem; padding-top: max(2rem, calc(var(--safe-top, 0px) + 3rem)); opacity: 0; transition: opacity 0.2s ease; pointer-events: none; }
.media-lightbox:not(.hidden) { opacity: 1; pointer-events: auto; }
.media-lightbox.image-viewer-closing { opacity: 0; pointer-events: none; }
.media-lightbox.hidden { display: none !important; transition: none; }
.media-lightbox-close { position: absolute; top: max(var(--safe-top), 0.5rem); right: max(var(--safe-right), 0.5rem); width: 48px; height: 48px; min-width: 48px; min-height: 48px; padding: 0; border: none; background: rgba(255,255,255,.25); color: #fff; font-size: 2rem; font-weight: 300; line-height: 1; cursor: pointer; border-radius: 50%; display: flex; align-items: center; justify-content: center; z-index: 10; -webkit-tap-highlight-color: transparent; transition: background .15s; }
.media-lightbox-close:hover, .media-lightbox-close:focus { background: rgba(255,255,255,.4); }
.media-lightbox-close:focus { outline: 2px solid #fff; outline-offset: 2px; }
.media-lightbox-content { max-width: 100%; max-height: 100%; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.media-lightbox-inner { transition: transform 0.1s ease-out; transform-origin: center center; pointer-events: auto; display: flex; align-items: center; justify-content: center; max-width: 100%; max-height: 100%; }
.media-lightbox-media { max-width: 100%; max-height: 85vh; width: auto; height: auto; object-fit: contain; border-radius: 8px; display: block; touch-action: none; }
.media-lightbox-content .media-lightbox-media { pointer-events: auto; }
img.card-photo, img.explore-shared-img, .msg img.media, .msg video.media, img.alter-ego-card-img, .gallery-item img, .profile-view-photos img, .profile-view-wrap img, video.explore-shared-video { cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
#card-stack .card-photo, #card-stack .card-photo-wrap { cursor: default; pointer-events: none; }
.text-muted { color: var(--text-muted); font-size: .9rem; }

/* The Kink Game */
.kink-game-container { margin-top: 1rem; padding: 1rem; background: var(--surface); border-radius: 12px; border: 1px solid var(--border); }
.kink-game-desc { font-size: .9rem; color: var(--text-muted); margin: .5rem 0 1rem; line-height: 1.4; }
.kink-game-btn { padding: .5rem 1rem; margin: .25rem; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; cursor: pointer; font-size: .9rem; }
.kink-game-btn.primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.kink-game-btn.secondary { background: var(--border); color: var(--text); }
.kink-game-card { margin-bottom: 1.25rem; padding: 1rem; background: var(--bg); border-radius: 10px; border: 1px solid var(--border); }
.kink-game-card h5 { margin: 0 0 .5rem; font-size: 1rem; }
.kink-game-card-desc { font-size: .85rem; color: var(--text); margin: .35rem 0; line-height: 1.35; }
.kink-game-card-tip { font-size: .8rem; color: var(--text-muted); margin: .5rem 0 .75rem; }
.kink-game-rate { display: flex; gap: .5rem; flex-wrap: wrap; }
.kink-game-rate .rate-btn { padding: .4rem .75rem; border-radius: 20px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; font-size: .85rem; }
.kink-game-rate .rate-btn.selected { background: var(--primary); color: #fff; border-color: var(--primary); }
.kink-game-nav { margin-top: 1rem; display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
#kink-game-progress { font-size: .9rem; color: var(--text-muted); margin-bottom: .75rem; }
.kink-match-section { margin: 1rem 0; }
.kink-match-section h5 { margin: 0 0 .5rem; font-size: .95rem; }
.kink-match-section ul { margin: 0; padding-left: 1.25rem; }
.kink-match-section li { margin: .25rem 0; }

/* Little Box Game */
.little-box-game-container { margin-top: 1rem; padding: 1rem; background: var(--surface); border-radius: 12px; border: 1px solid var(--border); }
.lbg-header-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem; margin-bottom: 0.5rem; }
.lbg-header-row h4 { margin: 0; }
.little-box-game-container h5 { margin: .75rem 0 .35rem; font-size: .95rem; }
.lbg-mode { display: flex; gap: 1rem; flex-wrap: wrap; margin: .75rem 0; }
.lbg-mode label { display: flex; align-items: center; gap: .5rem; }
.lbg-mode select { padding: .4rem .6rem; border: 1px solid var(--border); border-radius: 8px; }
.lbg-tools { display: grid; gap: 1rem; margin-top: 1rem; }
.lbg-tool { padding: .75rem; background: var(--bg); border-radius: 10px; border: 1px solid var(--border); }
.lbg-tool .kink-game-btn { margin: .35rem .35rem .35rem 0; }
.lbg-result { margin-top: .5rem; font-size: .9rem; }
.lbg-dice-result { margin: .5rem 0; font-size: 1.1rem; }
.lbg-dice { display: inline-block; min-width: 2rem; text-align: center; padding: .25rem .5rem; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; margin: 0 .2rem; }
.lbg-task { margin-top: .5rem; padding: .75rem; background: var(--surface); border-radius: 8px; border-left: 4px solid var(--primary); }
.lbg-task-text { margin: 0 0 .5rem; line-height: 1.4; }
.lbg-task-pts { margin: 0; font-size: .9rem; color: var(--primary); }
.lbg-card { padding: .75rem; background: var(--surface); border-radius: 8px; border: 1px solid var(--border); margin-top: .5rem; }
.lbg-card-face { font-size: 1.25rem; font-weight: 700; display: block; margin-bottom: .35rem; }
.lbg-timer-wrap { margin-top: .5rem; display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.lbg-timer-wrap input { width: 4rem; padding: .4rem; border: 1px solid var(--border); border-radius: 8px; }
.lbg-timer-display { font-size: 1.5rem; font-weight: 700; min-width: 4rem; }
.lbg-timer-done { color: var(--primary); animation: pulse 1s ease infinite; }
@keyframes pulse { 50% { opacity: .7; } }
.lbg-log { margin-top: 1rem; padding: .75rem; background: var(--bg); border-radius: 10px; }
.lbg-log ul { margin: .5rem 0; padding-left: 1.25rem; max-height: 12rem; overflow-y: auto; }
.lbg-log li { margin: .25rem 0; font-size: .9rem; }
.lbg-ref { margin-top: 1rem; font-size: .9rem; }
.lbg-ref details { margin: .5rem 0; }
.lbg-ref summary { cursor: pointer; font-weight: 600; }
.lbg-ref ul { margin: .35rem 0; padding-left: 1.25rem; }
#lbg-spinner-options { width: 100%; max-width: 360px; padding: .5rem; border: 1px solid var(--border); border-radius: 8px; margin-bottom: .35rem; }

/* Little Box Game — pop-out standalone overlay */
.lbg-popout-overlay { position: fixed; inset: 0; z-index: 400; background: var(--bg); padding: 1rem; padding-top: max(1rem, var(--safe-top)); padding-bottom: max(1rem, var(--safe-bottom)); overflow-y: auto; }
.lbg-popout-overlay.hidden { display: none !important; }
.lbg-popout-close { position: absolute; top: max(var(--safe-top), 0.5rem); right: max(var(--safe-right), 0.5rem); width: 44px; height: 44px; min-width: 44px; min-height: 44px; padding: 0; border: none; background: var(--border); color: var(--text); font-size: 1.75rem; line-height: 1; cursor: pointer; border-radius: 50%; display: flex; align-items: center; justify-content: center; z-index: 2; }
.lbg-popout-close:hover { background: var(--text-muted); color: var(--surface); }
.lbg-popout-slot { max-width: 640px; margin: 0 auto; padding-top: 2rem; }
.lbg-popout-slot .little-box-game-container { margin-top: 0; }

/* Little Box Game — drawn card full screen */
.lbg-card-fullscreen { position: fixed; inset: 0; z-index: 410; background: rgba(0,0,0,.92); display: flex; align-items: center; justify-content: center; padding: 2rem; }
.lbg-card-fullscreen.hidden { display: none !important; }
.lbg-card-fullscreen-close { position: absolute; top: max(var(--safe-top), 0.5rem); right: max(var(--safe-right), 0.5rem); width: 44px; height: 44px; min-width: 44px; min-height: 44px; padding: 0; border: none; background: rgba(255,255,255,.25); color: #fff; font-size: 1.75rem; line-height: 1; cursor: pointer; border-radius: 50%; display: flex; align-items: center; justify-content: center; z-index: 2; }
.lbg-card-fullscreen-close:hover { background: rgba(255,255,255,.4); }
.lbg-card-fullscreen-content { max-width: 90%; width: 420px; padding: 2rem; background: var(--surface); border-radius: 20px; box-shadow: 0 8px 32px rgba(0,0,0,.4); text-align: center; }
.lbg-card-fullscreen-content .lbg-card-face { font-size: 1.75rem; margin-bottom: 1rem; color: var(--primary); }
.lbg-card-fullscreen-content p { margin: 0 0 0.5rem; font-size: 1.25rem; line-height: 1.5; color: var(--text); }
.lbg-card-fullscreen-content small { font-size: 1rem; color: var(--text-muted); }

/* Disclaimer (Games panel) */
.disclaimer-block { margin-bottom: 1rem; padding: .75rem; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; font-size: .85rem; color: var(--text-muted); }
.disclaimer-block summary { cursor: pointer; font-weight: 600; color: var(--text); }
.disclaimer-block p { margin: .5rem 0 0; line-height: 1.45; }

/* Aftercare guide */
.aftercare-container { margin-top: 1rem; padding: 1rem; background: var(--surface); border-radius: 12px; border: 1px solid var(--border); }
.aftercare-container h4 { margin: 0 0 .5rem; }
.aftercare-container h5 { margin: .75rem 0 .35rem; font-size: .95rem; }

/* Negotiation worksheets */
.negotiation-worksheets-container { margin-top: 1rem; padding: 1rem; background: var(--surface); border-radius: 12px; border: 1px solid var(--border); }
.negotiation-worksheets-container h4 { margin: 0 0 .5rem; }
.negotiation-worksheets-container h5 { margin: .75rem 0 .35rem; font-size: .95rem; }
.negotiation-links { margin: .5rem 0; padding-left: 1.25rem; }
.negotiation-links li { margin: .5rem 0; line-height: 1.4; }
.negotiation-links a { color: var(--primary); text-decoration: none; }
.negotiation-links a:hover { text-decoration: underline; }
.lbg-ref.ul { list-style: disc; padding-left: 1.25rem; }
.lbg-ref.ul li { margin: .35rem 0; }

/* Couple tasks */
.tasks-section { margin-bottom: 1.25rem; }
.tasks-section h4 { margin: 0 0 0.5rem; font-size: 1rem; }
.tasks-list { list-style: none; padding: 0; margin: 0; }
.tasks-list .tasks-empty { color: var(--text-muted); font-size: .9rem; padding: 0.5rem 0; }
.task-item { display: flex; align-items: center; gap: 0.5rem; padding: 0.5rem 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.task-item.task-drag-over { background: var(--surface-hover, rgba(0,0,0,.04)); border-radius: 6px; }
.task-tick { flex-shrink: 0; width: 1.75rem; height: 1.75rem; border: 1px solid var(--border); border-radius: 50%; background: var(--surface); cursor: pointer; font-size: .9rem; line-height: 1; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.task-tick:hover { background: var(--surface-hover, #eee); }
.task-title { flex: 1; min-width: 0; }
.task-title.task-done { text-decoration: line-through; color: var(--text-muted); }
.task-delete { flex-shrink: 0; width: 1.5rem; height: 1.5rem; border: none; background: transparent; color: var(--text-muted); font-size: 1.2rem; line-height: 1; cursor: pointer; padding: 0; border-radius: 4px; }
.task-delete:hover { color: #c62828; background: rgba(198,40,40,.1); }
.task-drag-handle { cursor: grab; color: var(--text-muted); font-size: .9rem; padding: 0 .25rem; user-select: none; }
.task-drag-handle:active { cursor: grabbing; }
.tasks-add { display: flex; gap: 0.5rem; align-items: center; }
.tasks-add input { flex: 1; padding: 0.5rem 0.75rem; border: 1px solid var(--border); border-radius: 8px; font-size: 1rem; }
.tasks-add input:focus { outline: none; border-color: var(--primary); }

/* Explore shared (porn share) */
.explore-share-forms { display: flex; flex-direction: column; gap: 1rem; margin-top: 0.5rem; }
.explore-share-form { display: flex; flex-direction: column; gap: 0.4rem; }
.explore-share-form label { display: flex; flex-direction: column; gap: 0.2rem; font-size: 0.9rem; }
.explore-input { padding: 0.5rem 0.6rem; border: 1px solid var(--border); border-radius: 8px; font-size: 1rem; }
.explore-input:focus { outline: none; border-color: var(--primary); }
.explore-pending { font-size: 0.9rem; color: var(--text-muted); }
.explore-shared-feed-toolbar { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.75rem; }
.explore-shared-feed-toolbar .kink-game-btn { margin: 0; }
.explore-shared-empty { padding: 1rem 0; text-align: center; }
.explore-shared-empty .kink-desc { margin-bottom: 1rem; }
.explore-shared-empty-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem; }
.explore-shared-empty-actions .kink-game-btn { margin: 0; }
.explore-shared-feed { display: flex; flex-direction: column; gap: 1rem; margin-top: 0.5rem; }
.explore-shared-item { border: 1px solid var(--border); border-radius: 12px; padding: 0.75rem; background: var(--surface); }
.explore-shared-meta { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.5rem; display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.explore-shared-actions { margin-left: auto; display: inline-flex; align-items: center; gap: 0.25rem; flex-shrink: 0; }
.explore-shared-move-up,
.explore-shared-move-down,
.explore-shared-edit,
.explore-shared-delete { border: none; background: transparent; color: var(--text-muted); font-size: 0.9rem; cursor: pointer; padding: 0.25rem 0.4rem; border-radius: 4px; line-height: 1; white-space: nowrap; }
.explore-shared-move-up:hover,
.explore-shared-move-down:hover,
.explore-shared-edit:hover { color: var(--primary); background: rgba(233, 30, 99, 0.1); }
.explore-shared-delete { font-size: 1.1rem; }
.explore-shared-delete:hover { color: #c62828; background: rgba(198,40,40,.1); }
.explore-shared-edit-form { margin-top: 0.75rem; padding-top: 0.75rem; border-top: 1px solid var(--border); }
.explore-shared-edit-form.hidden { display: none !important; }
.explore-edit-label { display: block; margin-bottom: 0.5rem; font-size: 0.9rem; }
.explore-edit-label .explore-input { width: 100%; margin-top: 0.25rem; }
.explore-edit-buttons { margin-top: 0.5rem; }
.explore-edit-buttons .kink-game-btn { margin-right: 0.35rem; }
.explore-shared-media { margin: 0.5rem 0; border-radius: 8px; overflow: hidden; max-width: 100%; }
.explore-shared-img { max-width: 100%; max-height: 280px; width: auto; height: auto; display: block; }
.explore-shared-video { max-width: 100%; max-height: 320px; width: auto; display: block; border-radius: 8px; }
.explore-shared-link { margin: 0.35rem 0; }
.explore-shared-link a { color: var(--primary); word-break: break-all; }
.explore-shared-caption { margin: 0.35rem 0 0; font-size: 0.95rem; line-height: 1.4; }
.explore-shared-engagement { display: flex; align-items: center; flex-wrap: wrap; gap: 0.5rem 0.75rem; margin-top: 0.5rem; padding-top: 0.5rem; border-top: 1px solid var(--border); font-size: 0.9rem; }
.explore-shared-like-wrap { display: inline-flex; align-items: center; gap: 0.2rem; }
.explore-shared-like { border: none; background: transparent; color: var(--text-muted); cursor: pointer; font-size: 1.1rem; padding: 0.2rem 0.35rem; border-radius: 4px; }
.explore-shared-like:hover { color: var(--primary); }
.explore-shared-like.liked { color: #c62828; }
.explore-shared-like-count { font-size: 0.85rem; color: var(--text-muted); min-width: 1.2em; }
.explore-shared-react-wrap { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 0.25rem; position: relative; }
.explore-shared-react-btn { border: none; background: transparent; cursor: pointer; font-size: 1rem; padding: 0.2rem 0.35rem; border-radius: 4px; }
.explore-shared-react-btn:hover { background: rgba(233, 30, 99, 0.1); }
.explore-shared-reactions { display: inline-flex; align-items: center; gap: 0.15rem; }
.explore-shared-reaction { font-size: 1rem; }
button.explore-shared-reaction { border: none; background: transparent; cursor: pointer; padding: 0.1rem; border-radius: 4px; }
button.explore-shared-reaction:hover { background: rgba(0,0,0,0.06); }
.explore-shared-emoji-picker { margin-top: 0.25rem; }
.explore-shared-emoji-picker.hidden { display: none !important; }
.explore-emoji-picker-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 0.25rem; padding: 0.5rem; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; max-height: 140px; overflow-y: auto; }
.explore-emoji-item { border: none; background: transparent; cursor: pointer; font-size: 1.2rem; padding: 0.2rem; border-radius: 4px; }
.explore-emoji-item:hover { background: rgba(233, 30, 99, 0.1); }
.explore-shared-rate-wrap { display: inline-flex; align-items: center; gap: 0.1rem; }
.explore-shared-star { border: none; background: transparent; color: var(--border); cursor: pointer; font-size: 1.1rem; padding: 0.1rem; line-height: 1; }
.explore-shared-star.filled { color: #f9a825; }
.explore-shared-star:hover { color: #f9a825; }
.explore-shared-rating-avg { font-size: 0.85rem; color: var(--text-muted); margin-left: 0.25rem; }

/* Link preview cards (Explore) */
.explore-link-preview { display: block; margin: 0.5rem 0; border-radius: 12px; overflow: hidden; border: 1px solid var(--border); background: var(--surface); text-decoration: none; color: inherit; transition: border-color 0.2s, box-shadow 0.2s; }
.explore-link-preview:hover { border-color: var(--primary); box-shadow: 0 2px 8px rgba(233, 30, 99, 0.12); }
.explore-link-preview-thumb-wrap { position: relative; display: block; width: 100%; aspect-ratio: 16/9; background: var(--bg-alt, #f0f0f0); overflow: hidden; }
.explore-link-preview-thumb { width: 100%; height: 100%; object-fit: cover; display: block; vertical-align: top; }
.explore-link-preview-play { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 3rem; height: 3rem; border-radius: 50%; background: rgba(0,0,0,0.7); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 1rem; pointer-events: none; }
.explore-link-preview-body { display: block; padding: 0.75rem 1rem; }
.explore-link-preview-title { display: block; font-weight: 600; font-size: 1rem; margin-bottom: 0.25rem; color: var(--text); line-height: 1.3; }
.explore-link-preview-domain { display: block; font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.35rem; }
.explore-link-preview-desc { display: block; font-size: 0.9rem; color: var(--text-muted); line-height: 1.4; }
.explore-link-preview-website .explore-link-preview-body { display: flex; flex-direction: column; }
.explore-link-preview-video .explore-link-preview-title,
.explore-link-preview-video .explore-link-preview-domain { padding: 0 1rem; }
.explore-link-preview-video .explore-link-preview-title { padding-top: 0.75rem; }
.explore-link-preview-video .explore-link-preview-domain { padding-bottom: 0.75rem; }
.explore-link-preview-image { display: flex; flex-direction: column; }
.explore-link-preview-inline-img { max-width: 100%; width: auto; height: auto; max-height: 320px; display: block; border-radius: 8px; cursor: pointer; object-fit: contain; }
.explore-link-preview-image .explore-link-preview-title { padding: 0.5rem 0 0; }
.explore-link-preview-loading { display: block; font-size: 0.85rem; color: var(--text-muted); margin-top: 0.35rem; }
.explore-shared-link.explore-link-no-preview { margin-top: 0.5rem; }
/* Link card with optional image or placeholder “still” when no OG thumbnail */
a.explore-link-preview-card {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    flex-wrap: nowrap;
}
a.explore-link-preview-card .explore-link-preview-thumb-wrap {
    width: 38%;
    max-width: 200px;
    min-width: 118px;
    flex-shrink: 0;
    align-self: stretch;
}
a.explore-link-preview-card .explore-link-preview-body {
    flex: 1;
    min-width: 0;
    padding: 0.75rem 1rem;
    display: flex;
    flex-direction: column;
}
.explore-link-preview-placeholder {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    padding: 0.65rem 0.5rem;
    text-align: center;
    background: linear-gradient(145deg, rgba(233, 30, 99, 0.14) 0%, var(--bg) 42%, var(--surface) 100%);
    border-right: 1px solid var(--border);
    box-sizing: border-box;
}
[data-theme="dark"] .explore-link-preview-placeholder {
    background: linear-gradient(145deg, rgba(233, 30, 99, 0.2) 0%, #1a1724 40%, #252030 100%);
    border-right-color: var(--border);
}
.explore-link-preview-placeholder-shine {
    position: absolute;
    inset: -60%;
    background: linear-gradient(55deg, transparent 35%, rgba(255, 255, 255, 0.07) 48%, transparent 62%);
    animation: explore-link-placeholder-shine 5s ease-in-out infinite;
    pointer-events: none;
}
@keyframes explore-link-placeholder-shine {
    0%, 100% { transform: translateX(-35%) rotate(18deg); }
    50% { transform: translateX(35%) rotate(18deg); }
}
.explore-link-preview-placeholder-icon {
    font-size: 1.85rem;
    line-height: 1;
    opacity: 0.92;
    position: relative;
    z-index: 1;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.12));
}
.explore-link-preview-placeholder-label {
    position: relative;
    z-index: 1;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.explore-link-preview-placeholder-domain {
    position: relative;
    z-index: 1;
    font-size: 0.72rem;
    color: var(--text-muted);
    max-width: 100%;
    padding: 0 0.25rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
@media (max-width: 520px) {
    a.explore-link-preview-card {
        flex-direction: column;
    }
    a.explore-link-preview-card .explore-link-preview-thumb-wrap {
        width: 100%;
        max-width: none;
        min-height: 120px;
        aspect-ratio: 16 / 9;
    }
    .explore-link-preview-placeholder {
        border-right: none;
        border-bottom: 1px solid var(--border);
    }
}

/* Kudos */
.kudos-send { display: flex; flex-direction: column; gap: 0.6rem; margin-top: 0.75rem; }
.kudos-send label { display: flex; flex-direction: column; gap: 0.2rem; font-size: 0.9rem; }
.kudos-send select { padding: 0.5rem 0.6rem; border: 1px solid var(--border); border-radius: 8px; font-size: 1rem; max-width: 20rem; }
.kudos-send textarea { padding: 0.5rem 0.6rem; border: 1px solid var(--border); border-radius: 8px; font-size: 1rem; resize: vertical; }
.kudos-send textarea:focus { outline: none; border-color: var(--primary); }
.kudos-feed { display: flex; flex-direction: column; gap: 0.75rem; margin-top: 0.5rem; }
.kudos-item { border: 1px solid var(--border); border-radius: 12px; padding: 0.75rem; background: var(--surface); }
.kudos-meta { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.35rem; }
.kudos-kind { font-weight: 600; color: var(--primary); }
.kudos-message { margin: 0; font-size: 0.95rem; line-height: 1.45; white-space: pre-wrap; word-break: break-word; }

/* Home check-in (first thing on sign-in) */
.home-checkin-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 1rem; margin-bottom: 1rem; }
.home-checkin-card h3 { margin: 0 0 0.5rem; font-size: 1.15rem; }
.home-checkin-level-line { margin: 0.25rem 0 0.5rem; font-size: 0.95rem; }
.home-checkin-note { display: block; margin: 0.5rem 0; font-size: 0.9rem; }
.home-checkin-note input { width: 100%; padding: 0.4rem 0.5rem; border: 1px solid var(--border); border-radius: 8px; margin-top: 0.2rem; }
.home-checkin-email { display: block; margin: 0.5rem 0; font-size: 0.9rem; }
.home-checkin-email input { margin-right: 0.35rem; }
.home-checkin-sent-at { margin: 0.5rem 0 0; font-size: 0.9rem; color: var(--text-muted); }
.home-checkin-done .home-checkin-done-mood { margin: 0 0 0.25rem; font-size: 1.1rem; font-weight: 600; color: var(--text); }
.home-checkin-done .home-checkin-sent-at { margin: 0.25rem 0 0.5rem; font-size: 0.9rem; color: var(--text-muted); }
.home-checkin-done #home-checkin-again { margin-top: 0.5rem; }
.home-mood-history { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 1rem; margin-bottom: 1rem; }
.home-mood-history h4 { margin: 0 0 0.75rem; font-size: 1rem; }
.home-mood-period-tabs { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-bottom: 0.85rem; }
.home-mood-period-tab {
    flex: 1 1 auto;
    min-width: 4.5rem;
    padding: 0.4rem 0.5rem;
    font-size: 0.8rem;
    font-weight: 600;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg, var(--surface));
    color: var(--text-muted);
    cursor: pointer;
}
.home-mood-period-tab:hover { color: var(--text); border-color: var(--text-muted); }
.home-mood-period-tab.active {
    background: var(--accent, #c9a227);
    color: var(--accent-contrast, #1a1a1a);
    border-color: transparent;
}
.home-mood-detail-today { margin-bottom: 0.75rem; }
.home-mood-detail-today.hidden { display: none; }
.home-mood-history-section { margin-bottom: 1rem; }
.home-mood-history-section:last-child { margin-bottom: 0; }
.home-mood-history-section h5 { margin: 0 0 0.35rem; font-size: 0.95rem; font-weight: 600; color: var(--text-muted); }
.home-mood-counts-block { margin-top: 0.25rem; padding-top: 0.5rem; border-top: 1px solid var(--border); }
.home-mood-counts-heading { margin-top: 0.75rem; }
.home-mood-counts-heading:first-child { margin-top: 0; }
.home-mood-counts-list { list-style: none; margin: 0 0 0.5rem; padding: 0; font-size: 0.9rem; }
.home-mood-counts-list li {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.75rem;
    padding: 0.25rem 0;
    border-bottom: 1px solid var(--border);
}
.home-mood-counts-list li:last-child { border-bottom: none; }
.home-mood-count-label { color: var(--text); }
.home-mood-count-num { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text-muted); }
.home-checkins-list { margin: 0; padding-left: 1.25rem; font-size: 0.95rem; }
.home-checkins-list .home-checkin-item { margin-bottom: 0.25rem; }
#home-my-checkins-list .home-checkin-item-mine { list-style: none; margin-left: -1.25rem; padding-left: 0; margin-bottom: 0.65rem; }
.home-checkin-item-mine .home-checkin-item-view { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem 0.5rem; text-align: left; }
.home-checkin-item-mine .home-checkin-item-text { flex: 1 1 12rem; min-width: 0; }
.home-checkin-item-mine .home-checkin-edit,
.home-checkin-item-mine .home-checkin-delete { flex: 0 0 auto; font-size: 0.82rem; padding: 0.35rem 0.55rem; }
.home-checkin-item-mine .home-checkin-item-edit { margin-top: 0.35rem; padding-top: 0.5rem; border-top: 1px solid var(--border); text-align: left; }
.home-checkin-item-mine .home-checkin-item-edit .home-checkin-edit-field { display: flex; flex-direction: column; gap: 0.2rem; margin-bottom: 0.5rem; max-width: 100%; }
.home-checkin-item-mine .home-checkin-edit-caption { font-size: 0.75rem; color: var(--muted, #64748b); }
.home-checkin-item-mine .home-checkin-edit-mood,
.home-checkin-item-mine .home-checkin-edit-note,
.home-checkin-item-mine .home-checkin-edit-datetime { width: 100%; max-width: 22rem; box-sizing: border-box; }
.home-checkin-item-mine .home-checkin-item-edit .home-checkin-edit-save,
.home-checkin-item-mine .home-checkin-item-edit .home-checkin-edit-cancel { margin-right: 0.35rem; margin-top: 0.15rem; }
.home-checkins-empty { margin: 0; font-size: 0.9rem; color: var(--text-muted); }

/* Mood palette editor (Profile → Settings) — touch-friendly reorder */
.mood-palette-editor-list {
    list-style: none;
    margin: 0 0 0.75rem;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.mood-palette-editor-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.65rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
}
.mood-palette-editor-move {
    display: flex;
    flex-direction: row;
    gap: 0.35rem;
    flex: 0 0 auto;
}
.mood-palette-move {
    min-width: 2.75rem;
    min-height: 2.75rem;
    padding: 0.35rem;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg, var(--surface));
    color: var(--text);
    cursor: pointer;
}
.mood-palette-move:active { opacity: 0.85; }
.mood-palette-editor-fields {
    flex: 1 1 200px;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    min-width: 0;
}
.mood-palette-field-label {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-muted);
    margin-bottom: 0.15rem;
}
.mood-palette-emoji-wrap input.mood-palette-emoji-in {
    width: 100%;
    max-width: 7rem;
    padding: 0.45rem 0.5rem;
    font-size: 1.1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    box-sizing: border-box;
}
.mood-palette-label-wrap input.mood-palette-label-in {
    width: 100%;
    padding: 0.45rem 0.5rem;
    font-size: 0.95rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    box-sizing: border-box;
}
.mood-palette-builtin-label-text {
    font-size: 0.95rem;
    font-weight: 600;
}
.mood-palette-remove {
    flex: 1 1 100%;
    min-height: 2.5rem;
}
@media (min-width: 520px) {
    .mood-palette-editor-row {
        flex-wrap: nowrap;
        align-items: center;
    }
    .mood-palette-editor-move { flex-direction: column; }
    .mood-palette-remove {
        flex: 0 0 auto;
        align-self: center;
        min-width: 5.5rem;
    }
}
.mood-palette-editor-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    align-items: center;
}
.mood-palette-editor-actions .kink-game-btn { flex: 1 1 auto; min-width: 8rem; }
.home-partner-checkin-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 0.75rem 1rem; margin-bottom: 1rem; }
.home-partner-checkin-card h4 { margin: 0 0 0.35rem; font-size: 1rem; }
.home-partner-checkin-text { margin: 0; font-size: 0.95rem; }
.connect-partner-checkin-today { margin-bottom: 0.75rem; }
.connect-partner-checkin-today .connect-partner-checkin-text { font-weight: 500; }
.connect-intimacy-list { display: flex; flex-direction: column; gap: 0.5rem; }
.connect-intimacy-oral-fields { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; width: 100%; }
.connect-intimacy-oral-fields.hidden { display: none !important; }
.connect-intimacy-row { display: flex; align-items: center; flex-wrap: wrap; gap: 0.5rem; }
.connect-intimacy-label { min-width: 10rem; font-size: 0.95rem; }
.connect-intimacy-date { font-weight: 500; min-width: 6rem; }
.connect-intimacy-input { padding: 0.3rem 0.5rem; border: 1px solid var(--border); border-radius: 8px; }
.connect-intimacy-input.hidden { display: none; }
.connect-intimacy-log { margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.connect-intimacy-log h5 { margin: 0 0 0.35rem; font-size: 0.95rem; color: var(--text-muted, #666); }
.connect-intimacy-log-hint { margin: 0 0 0.65rem; font-size: 0.85rem; }
.connect-intimacy-log .connect-intimacy-log-list { list-style: none; margin: 0; padding: 0; font-size: 0.9rem; }
.connect-intimacy-log-item { margin-bottom: 0.75rem; padding: 0.65rem 0.75rem; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.connect-intimacy-log-item:last-child { margin-bottom: 0; }
.connect-intimacy-log-view { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 0.5rem; }
.connect-intimacy-log-view.hidden { display: none !important; }
.connect-intimacy-log-main { flex: 1; min-width: 0; line-height: 1.45; }
.connect-intimacy-log-actions { display: flex; flex-wrap: wrap; gap: 0.35rem; flex-shrink: 0; align-items: center; }
.connect-intimacy-log-actions .kink-game-btn { padding: 0.35rem 0.65rem; font-size: 0.85rem; min-height: 0; }
.connect-intimacy-log-edit-form { margin-top: 0.5rem; padding-top: 0.5rem; border-top: 1px solid var(--border); }
.connect-intimacy-log-edit-form.hidden { display: none !important; }
.connect-intimacy-log-date-label { display: block; margin-bottom: 0.5rem; font-size: 0.9rem; }
.connect-intimacy-log-edit-actions { display: flex; gap: 0.35rem; flex-wrap: wrap; margin-top: 0.25rem; }
.connect-intimacy-log-empty { list-style: none; padding-left: 0; color: var(--text-muted, #666); }
.home-partner-notification { background: rgba(var(--primary-rgb, 100, 100, 200), 0.12); border: 1px solid var(--primary); border-radius: 12px; padding: 0.75rem 1rem; margin-bottom: 1rem; display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; flex-wrap: wrap; }
.home-partner-notification span { flex: 1; min-width: 0; }
.settings-email-label { display: block; margin-top: 0.5rem; font-size: 0.9rem; }
.settings-email-label input { width: 100%; max-width: 20rem; padding: 0.4rem 0.5rem; margin-top: 0.2rem; border: 1px solid var(--border); border-radius: 8px; }

/* Connect panel */
.connect-section { margin-bottom: 1.5rem; }
.connect-section h4 { margin: 0 0 0.5rem; font-size: 1rem; }
.connect-dates-desc { padding: 0.5rem 0.75rem; }
.streak-number { font-size: 2rem; font-weight: 700; color: var(--primary); margin: 0.25rem 0; }
.prompt-reveal-item { margin: 0.5rem 0; padding: 0.5rem; background: var(--surface); border-radius: 8px; }
.home-mood-add-custom-wrap { margin: 0.35rem 0 0.5rem; text-align: left; max-width: 100%; }
.home-mood-shared-hint { margin: 0 0 0.5rem !important; font-size: 0.85rem; line-height: 1.35; }
.home-mood-add-custom-panel { margin-top: 0.5rem; padding: 0.75rem; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.home-mood-add-custom-fields { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; margin-bottom: 0.65rem; }
.home-mood-add-field { display: flex; flex-direction: column; gap: 0.2rem; flex: 1 1 140px; min-width: 0; text-align: left; }
.home-mood-add-field-caption { font-size: 0.75rem; color: var(--muted, #64748b); }
.home-mood-add-field input { width: 100%; box-sizing: border-box; max-width: 100%; }
.home-mood-add-custom-msg { margin: 0.5rem 0 0 !important; }

.mood-buttons { display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0.5rem 0; }
.mood-buttons.mood-buttons-deletable .mood-btn-wrap {
    display: inline-flex;
    flex-direction: row;
    align-items: stretch;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--surface);
}
.mood-buttons.mood-buttons-deletable .mood-btn-wrap .mood-btn {
    border: none;
    border-radius: 0;
    margin: 0;
}
.mood-buttons.mood-buttons-deletable .mood-btn-wrap .mood-btn-delete {
    flex: 0 0 auto;
    padding: 0 0.4rem;
    min-width: 36px;
    min-height: var(--touch-min, 44px);
    border: none;
    border-left: 1px solid var(--border);
    background: var(--surface);
    color: var(--muted, #64748b);
    font-size: 1.15rem;
    line-height: 1;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.mood-buttons.mood-buttons-deletable .mood-btn-wrap .mood-btn-delete:hover {
    background: rgba(185, 28, 28, 0.08);
    color: #b91c1c;
}
.mood-buttons.mood-buttons-deletable .mood-btn-wrap:has(.mood-btn.active) {
    border-color: var(--primary);
}
.mood-buttons.mood-buttons-deletable .mood-btn-wrap:has(.mood-btn.active) .mood-btn-delete {
    border-left-color: rgba(255, 255, 255, 0.35);
    background: var(--primary);
    color: rgba(255, 255, 255, 0.92);
}
.mood-buttons.mood-buttons-deletable .mood-btn-wrap:has(.mood-btn.active) .mood-btn-delete:hover {
    background: rgba(0, 0, 0, 0.12);
    color: #fff;
}
.mood-btn { padding: 0.4rem 0.6rem; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); cursor: pointer; font-size: 0.9rem; }
.mood-btn:hover { border-color: var(--primary); }
.mood-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
#daily-prompt-answer { width: 100%; padding: 0.5rem; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 0.5rem; }

/* Date night */
.dates-calendar-wrap { margin-bottom: 1rem; }
.dates-calendar { background: var(--bg-alt, #f8f8f8); border-radius: 10px; padding: 0.75rem; border: 1px solid var(--border); }
.dates-calendar-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.5rem; }
.dates-calendar-title { font-weight: 600; font-size: 0.95rem; }
.dates-calendar-prev, .dates-calendar-next { border: none; background: transparent; cursor: pointer; padding: 0.35rem 0.5rem; font-size: 1.1rem; color: var(--text-muted); border-radius: 6px; }
.dates-calendar-prev:hover, .dates-calendar-next:hover { background: var(--border); color: var(--text); }
.dates-calendar-weekdays { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; margin-bottom: 4px; text-align: center; font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; }
.dates-calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.dates-calendar-day { text-align: center; padding: 0.4rem 0; font-size: 0.85rem; border-radius: 6px; }
.dates-calendar-day-empty { visibility: hidden; }
.dates-calendar-today { background: var(--primary); color: #fff; font-weight: 600; }
.dates-calendar-has-date { background: rgba(233, 30, 99, 0.2); font-weight: 500; }
.dates-calendar-has-date.dates-calendar-today { background: var(--primary); color: #fff; }

.dates-entries { margin-bottom: 1rem; }
.dates-entry-item { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; padding: 0.5rem 0; border-bottom: 1px solid var(--border); }
.dates-date { font-size: 0.85rem; color: var(--text-muted); }
.dates-done-badge { background: var(--primary); color: #fff; font-size: 0.75rem; padding: 0.15rem 0.4rem; border-radius: 6px; }
.dates-cat { margin-bottom: 1rem; }
.dates-cat h5 { margin: 0 0 0.5rem; font-size: 0.95rem; text-transform: capitalize; display: inline; }
.dates-delete-category-btn { margin-left: 0.5rem; font-size: 0.8rem; }
.dates-idea-item { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; padding: 0.4rem 0; transition: background 0.25s ease, transform 0.3s ease; }
.dates-idea-item.dates-idea-moved { animation: dates-idea-slide 0.4s ease; }
@keyframes dates-idea-slide { 0% { background: rgba(233, 30, 99, 0.25); transform: scale(1.02); } 100% { background: transparent; transform: scale(1); } }
.dates-idea-title { flex: 1; min-width: 0; }
.dates-move-idea-btn { border: none; background: transparent; color: var(--text-muted); cursor: pointer; font-size: 1rem; padding: 0.2rem 0.4rem; border-radius: 4px; line-height: 1; }
.dates-move-idea-btn:hover { background: var(--border); color: var(--primary); }
.dates-remove-btn { border: none; background: transparent; color: var(--text-muted); cursor: pointer; font-size: 1.2rem; padding: 0 0.25rem; }
.dates-delete-idea-btn { border: none; background: transparent; color: var(--text-muted); cursor: pointer; font-size: 1.1rem; padding: 0 0.25rem; }
.dates-delete-idea-btn:hover { color: var(--primary); }
.word-filter-table-wrap { margin-top: 0.5rem; overflow-x: auto; }
.word-filter-table { width: 100%; border-collapse: collapse; border: 1px solid var(--border); border-radius: 8px; }
.word-filter-table th { text-align: left; padding: 0.5rem 0.6rem; background: var(--bg-alt, rgba(0,0,0,0.04)); font-size: 0.9rem; font-weight: 600; border-bottom: 1px solid var(--border); }
.word-filter-table th:first-child { border-radius: 8px 0 0 0; }
.word-filter-table th:last-child { width: 2.5rem; text-align: center; border-radius: 0 8px 0 0; }
.word-filter-table td { padding: 0.35rem 0.5rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.word-filter-table tbody tr:last-child td { border-bottom: none; }
.word-filter-table tbody tr:last-child td:first-child { border-radius: 0 0 0 8px; }
.word-filter-table tbody tr:last-child td:last-child { border-radius: 0 0 8px 0; }
.word-filter-table input { width: 100%; min-width: 0; padding: 0.35rem 0.5rem; border: 1px solid var(--border); border-radius: 6px; box-sizing: border-box; }
.word-filter-table .word-filter-remove { border: none; background: transparent; color: var(--text-muted); cursor: pointer; padding: 0.25rem; font-size: 1.1rem; min-width: 2rem; }
.word-filter-table .word-filter-remove:hover { color: var(--primary); }
 .dates-section { margin-bottom: 1.25rem; }
.dates-form label { display: block; margin-bottom: 0.5rem; }
.dates-form input[type="text"], .dates-form select { width: 100%; max-width: 280px; padding: 0.4rem 0.5rem; margin-left: 0; margin-top: 0.2rem; border: 1px solid var(--border); border-radius: 6px; }
.dates-form .kink-game-btn { margin-top: 0.5rem; }
.dates-add-idea-inline { margin: 0.75rem 0; padding: 0.75rem 0; border-top: 1px solid var(--border); }
.dates-add-idea-inline h5 { margin: 0 0 0.5rem; font-size: 0.95rem; font-weight: 600; }
.dates-add-idea-inline .dates-form { margin-top: 0.5rem; }
.dates-move-btn { font-size: 0.85rem; padding: 0.2rem 0.5rem; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); cursor: pointer; }
.dates-move-wrap { margin-top: 0.5rem; padding: 0.5rem; background: var(--bg-alt, #f5f5f5); border-radius: 8px; display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.dates-move-wrap input[type="date"] { padding: 0.3rem 0.5rem; border: 1px solid var(--border); border-radius: 6px; }
.dates-proposals { margin-bottom: 0.5rem; }
.dates-proposal-item { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; padding: 0.5rem 0; border-bottom: 1px solid var(--border); }
.dates-proposal-title { font-weight: 600; }
.dates-proposal-msg { font-size: 0.9rem; color: var(--text-muted); font-style: italic; }
.dates-proposal-status { font-size: 0.85rem; color: var(--text-muted); }

.dates-timeline-section { margin-bottom: 1.5rem; }
.dates-timeline-list { margin-bottom: 0.75rem; }
.dates-timeline-item { padding: 0.6rem 0; border-bottom: 1px solid var(--border); display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.5rem; }
.dates-timeline-date { font-size: 0.85rem; color: var(--text-muted); min-width: 6rem; }
.dates-timeline-title { font-weight: 600; }
.dates-timeline-notes { width: 100%; font-size: 0.9rem; color: var(--text-muted); margin-top: 0.25rem; font-style: italic; }
.dates-timeline-actions { margin-left: auto; }
.dates-timeline-edit-form { width: 100%; margin-top: 0.5rem; padding: 0.75rem; background: var(--bg-alt, #f8f8f8); border-radius: 8px; }
.dates-timeline-edit-form label { display: block; margin-bottom: 0.5rem; }
.dates-timeline-edit-form input, .dates-timeline-edit-form textarea { width: 100%; max-width: 320px; padding: 0.4rem 0.5rem; border: 1px solid var(--border); border-radius: 6px; }
.dates-timeline-edit-form textarea { min-height: 3rem; resize: vertical; }
.dates-timeline-edit-form .kink-game-btn { margin-top: 0.5rem; margin-right: 0.5rem; }

/* Love languages */
.love-q { margin: 1rem 0; padding: 0.75rem; border: 1px solid var(--border); border-radius: 8px; }
.love-q p { margin: 0 0 0.5rem; font-weight: 500; }
.love-q label { display: block; margin: 0.35rem 0; cursor: pointer; }
.love-scores { list-style: none; padding: 0; margin: 0; }
.love-scores li { padding: 0.35rem 0; border-bottom: 1px solid var(--border); }

/* Alter egos */
.alter-egos-list { display: flex; flex-direction: column; gap: 1rem; margin-bottom: 1rem; }
.alter-ego-card { display: flex; align-items: center; gap: 1rem; padding: 0.75rem; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.alter-ego-card-img { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; background: var(--border); }
.alter-ego-card-body { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; }
.alter-ego-card-name { font-weight: 600; }
.alter-ego-shared-badge { font-size: 0.75rem; color: var(--text-muted); }
.alter-ego-card-rel { width: 100%; flex-basis: 100%; display: flex; flex-direction: column; gap: 0.12rem; margin-top: 0.2rem; font-size: 0.78rem; color: var(--text-muted); line-height: 1.35; }
.alter-ego-card-rel-seeking { font-size: 0.74rem; opacity: 0.95; }
.alter-ego-card-sex { width: 100%; flex-basis: 100%; display: flex; flex-direction: column; gap: 0.12rem; margin-top: 0.15rem; font-size: 0.76rem; color: var(--text-muted); line-height: 1.35; }
.alter-ego-card-sex-seeking { font-size: 0.72rem; opacity: 0.95; }
.alter-ego-card-actions { display: flex; gap: 0.5rem; }
.alter-ego-form { margin-top: 0.5rem; }
.alter-ego-form label { display: block; margin-bottom: 0.5rem; }
.alter-ego-form input[type="text"], .alter-ego-form select, .alter-ego-form textarea { width: 100%; max-width: 320px; padding: 0.4rem 0.5rem; margin-top: 0.2rem; border: 1px solid var(--border); border-radius: 6px; }
.alter-ego-form textarea { min-height: 4rem; resize: vertical; }
.alter-ego-share-wrap { margin: 0.75rem 0; }
.alter-ego-form-buttons { margin-top: 1rem; display: flex; gap: 0.5rem; }

/* ---------- Mobile & responsive ---------- */
@media (max-width: 768px) {
    .profile-edit-grid { grid-template-columns: 1fr; }
    .alter-ego-form.profile-edit-grid { grid-template-columns: 1fr; }
    .connect-sub-tab { min-height: var(--touch-min); padding: 0.6rem 0.75rem; }
    .profile-tab { min-height: var(--touch-min); padding: 0.5rem 0.75rem; }
    .stories-categories-tabs button { min-height: var(--touch-min); padding: 0.5rem 0.85rem; }
    .stories-add-btn, .stories-add-category-btn, .stories-add-literotica-btn { min-height: var(--touch-min); }
    .explore-shared-move-up, .explore-shared-move-down, .explore-shared-edit, .explore-shared-delete,
    .explore-shared-like, .explore-shared-react-btn, .explore-shared-star, .explore-emoji-item, button.explore-shared-reaction { min-width: 44px; min-height: 44px; padding: 0.5rem; }
    .kink-game-btn { min-height: 44px; padding: 0.6rem 1rem; }
    .profile-edit-actions .kink-game-btn { min-height: var(--touch-min); }
    .alter-ego-form .profile-edit-input, .alter-ego-form input, .alter-ego-form select, .alter-ego-form textarea { max-width: none; width: 100%; }
    .quick-consent { min-height: 44px; padding: 0.5rem 0.75rem; }
    .chat-tab { min-height: 44px; padding: 0.5rem 0.85rem; }
    .settings-list button, .settings-list .kink-game-btn { min-height: 44px; }
    #btn-theme { min-height: 44px; padding: 0.5rem 1rem; }
    .alter-ego-card-actions .kink-game-btn { min-height: 44px; }
    .dates-propose-btn, .dates-add-idea-btn, .dates-propose-idea, .dates-form input, .dates-form select { min-height: 44px; }
    .dates-form input[type="text"], .dates-form select, .word-filter-rule-row input { max-width: 100%; }
    .dates-timeline-edit-form input, .dates-timeline-edit-form textarea { max-width: 100%; }
    /* Loaders: visible + animated on mobile WebKit; room for overlay on wide chat bubbles */
    .reconnect-heart-loader--compact {
        width: 44px;
        height: 44px;
    }
    .reconnect-media-shell-overlay {
        z-index: 6;
    }
    .reconnect-media-shell-label {
        font-size: max(0.78rem, 12px);
    }
    .msg-body .reconnect-media-shell.reconnect-media-shell--busy {
        width: 100%;
        min-height: 120px;
        min-height: min(128px, 40vw);
    }
    .explore-shared-body .reconnect-media-shell.reconnect-media-shell--busy {
        min-height: 160px;
        min-height: min(200px, 52vw);
    }
    .chat-messages-loading {
        min-height: 220px;
        min-height: min(240px, 42vh);
        padding: 2rem 1rem;
    }
    .card-photo-loading-msg .loader.reconnect-heart-loader {
        width: 56px;
        height: 56px;
    }
    .profile-view-photo-loading .loader.reconnect-heart-loader {
        width: 52px;
        height: 52px;
    }
}
@media (max-width: 480px) {
    .panel { padding: 0.75rem; padding-left: max(0.75rem, var(--safe-left)); padding-right: max(0.75rem, var(--safe-right)); }
    .profile-card { width: 96%; max-width: none; }
    .card-stack { min-height: 360px; max-width: 100%; }
    /*
     * Home match card on phones: avoid a short flex+scroll .card-body (margin-top:auto on actions
     * can leave name/role/bio scrolled out of view; hidden scrollbar made that worse). Let the card
     * grow with content and scroll inside .main-content instead.
     */
    #card-stack .profile-card .card-photo-wrap {
        max-height: min(220px, 36vh);
        flex: 0 0 auto;
    }
    /* Direct child = single card (works without :has()). Stacked cards use .card-stack-item > .profile-card. */
    #card-stack > .profile-card,
    #card-stack:not(:has(.card-stack-item)) .profile-card,
    #card-stack .card-stack-item .profile-card {
        max-height: none;
    }
    #card-stack .profile-card .card-body {
        flex: 0 0 auto;
        min-height: 0;
        overflow: visible;
        position: relative;
        z-index: 1;
        -webkit-overflow-scrolling: touch;
        padding: 0.85rem 1rem;
    }
    #card-stack .profile-card .card-actions {
        margin-top: 0.75rem;
    }
    .swipe-buttons { gap: 1.25rem; margin-top: 1rem; }
    .swipe-btn { width: 56px; height: 56px; font-size: 1.6rem; }
    .messages { max-height: calc(100vh - 200px); max-height: calc(100dvh - 200px); padding: 0.75rem; }
    .chat-header { padding: 0.6rem 0.75rem; }
    .composer { padding: 0.5rem 0.75rem; padding-bottom: max(0.5rem, var(--safe-bottom)); }
    .composer-input-wrap { gap: 0.4rem; }
    .composer textarea { min-height: 44px; padding: 0.6rem 0.75rem; }
    .composer .send-btn { width: 44px; height: 44px; min-width: 44px; min-height: 44px; }
    .composer-emoji-btn, .composer-attach-btn { min-width: 44px; min-height: 44px; padding: 0.5rem; }
    .match-overlay { padding: 1.25rem; }
    .match-overlay h3 { font-size: 1.6rem; }
    .match-overlay .btn { padding: 0.75rem 1.5rem; min-height: var(--touch-min); }
    .connect-intimacy-row { flex-direction: column; align-items: flex-start; gap: 0.35rem; }
    .connect-intimacy-label { min-width: 0; }
    .connect-intimacy-date { min-width: 0; }
    .connect-intimacy-log-view { flex-direction: column; align-items: stretch; }
    .connect-intimacy-log-actions { justify-content: flex-start; }
    .connect-intimacy-log-actions .kink-game-btn { min-height: 44px; padding: 0.5rem 0.75rem; }
    .connect-intimacy-log-edit-actions .kink-game-btn { min-height: 44px; }
    .mood-buttons { gap: 0.4rem; }
    .mood-btn { padding: 0.5rem 0.75rem; min-height: var(--touch-min); min-width: 44px; }
    .mood-buttons.mood-buttons-deletable .mood-btn-wrap .mood-btn-delete { min-height: var(--touch-min); min-width: 44px; padding: 0 0.5rem; }
    #daily-prompt-answer { font-size: 16px; min-height: 44px; }
    #login-screen { padding: 0.75rem; padding-left: max(0.75rem, var(--safe-left)); padding-right: max(0.75rem, var(--safe-right)); }
    .login-box { padding: 1.25rem; margin: 0; width: 100%; }
    .profile-view-photos img { width: 140px; min-width: 140px; height: 175px; }
    .profile-view-photo-wrap, .profile-view-photo-wrap .profile-view-photo-img { width: 140px; min-width: 140px; height: 175px; }
    .profile-view-name { font-size: 1.4rem; }
    .profile-edit-input, .profile-edit-input::placeholder { font-size: 16px; }
    textarea.profile-edit-input { font-size: 16px; }
    input[type="text"], input[type="email"], input[type="password"], input[type="date"], input[type="number"],
    select, textarea { font-size: 16px !important; }
    .tasks-add input { font-size: 16px; }
    .explore-input, .kudos-send textarea, .kudos-send select { font-size: 16px; }
    .home-checkin-note input { font-size: 16px; }
    .home-checkin-item-mine .home-checkin-edit-datetime { font-size: 16px; }
    .settings-email-label input { font-size: 16px; }
    .stories-form-wrap input, .stories-form-wrap select, .stories-form-wrap textarea { font-size: 16px; }
    #custom-tag-input { font-size: 16px; }
    .reflections-form textarea, .boundaries-form textarea { font-size: 16px; }
    .dates-form input[type="text"], .dates-form select, .dates-move-wrap input[type="date"] { font-size: 16px; }
    .dates-timeline-edit-form input, .dates-timeline-edit-form textarea { font-size: 16px; }
    .alter-ego-form input[type="text"], .alter-ego-form select, .alter-ego-form textarea { font-size: 16px; }
    .tap-btn { min-height: var(--touch-min); padding: 0.75rem 1.25rem; }
    #desires-save, #btn-reflections, #btn-boundaries, #btn-kink-ping, .edit-profile-btn,
    .login-box button { min-height: var(--touch-min); }
    .task-tick { width: 2rem; height: 2rem; }
    .task-delete { width: 2rem; height: 2rem; }
    .glossary-popup { width: 92%; max-width: none; }
}
@media (max-width: 414px) {
    .panel { padding: 0.85rem; padding-left: max(0.85rem, var(--safe-left)); padding-right: max(0.85rem, var(--safe-right)); }
    .bottom-nav a { padding: 0.5rem 0.5rem; min-width: 44px; }
    .bottom-nav a .icon { font-size: 1.35rem; }
}
@media (max-width: 360px) {
    .panel { padding: 0.5rem; padding-left: max(0.5rem, var(--safe-left)); padding-right: max(0.5rem, var(--safe-right)); }
    .profile-card { width: 98%; }
    .card-stack { min-height: 320px; }
    #card-stack .profile-card .card-photo-wrap { max-height: min(200px, 34vh); }
    .swipe-btn { width: 52px; height: 52px; font-size: 1.5rem; }
    .profile-view-photos img { width: 120px; min-width: 120px; height: 150px; }
    .profile-view-photo-wrap, .profile-view-photo-wrap .profile-view-photo-img { width: 120px; min-width: 120px; height: 150px; }
    .bottom-nav a { padding: 0.4rem 0.35rem; font-size: 0.65rem; min-width: 40px; }
    .bottom-nav a .icon { font-size: 1.25rem; }
}
@media (max-width: 320px) {
    .panel { padding: 0.4rem; padding-left: max(0.4rem, var(--safe-left)); padding-right: max(0.4rem, var(--safe-right)); }
    .login-box { padding: 1rem; }
    .swipe-buttons { gap: 1rem; }
    .swipe-btn { width: 48px; height: 48px; font-size: 1.4rem; }
    #card-stack .profile-card .card-photo-wrap { max-height: min(180px, 30vh); }
    .card-stack { min-height: 280px; }
    .match-overlay h3 { font-size: 1.4rem; }
    .composer { padding: 0.4rem 0.6rem; padding-bottom: max(0.4rem, var(--safe-bottom)); }
    .chat-header { padding: 0.5rem 0.6rem; font-size: 0.95rem; }
}
@media (min-width: 1024px) {
    .main-content { max-width: 1024px; margin: 0 auto; }
    .panel { padding: 1.25rem; }
    .card-stack { max-width: 400px; }
    .profile-card { max-width: 380px; }
}
@media (orientation: landscape) and (max-height: 500px) {
    .messages { max-height: calc(100vh - 200px); max-height: calc(100dvh - 200px); }
    .match-overlay { padding: 0.75rem; }
    .match-overlay h3 { font-size: 1.35rem; }
}

/* Browsers without backdrop-filter: solid chrome so bars stay readable */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .app-top-bar,
    .bottom-nav,
    .app-footer {
        background: var(--surface);
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
    }
    #panel-chat.active {
        background: var(--surface);
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
    }
}
