:root {
    --bg: #f7f6f2;
    --bg-strong: #efe8dc;
    --surface: rgba(255, 255, 255, 0.88);
    --surface-strong: #ffffff;
    --text: #1f1a17;
    --muted: #6e6259;
    --line: rgba(31, 26, 23, 0.12);
    --accent: #d55f3a;
    --accent-strong: #b54a29;
    --highlight: #f2b872;
    --ok: #2d8a51;
    --error: #b3303d;
    --shadow: 0 20px 50px rgba(41, 26, 15, 0.14);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at 15% 15%, rgba(213, 95, 58, 0.22), transparent 28%),
        radial-gradient(circle at 80% 85%, rgba(242, 184, 114, 0.25), transparent 35%),
        linear-gradient(135deg, var(--bg) 0%, var(--bg-strong) 100%);
    min-height: 100vh;
}

h1,
h2,
h3,
.eyebrow {
    font-family: "Trebuchet MS", "Segoe UI", Arial, sans-serif;
}

.auth-page {
    position: relative;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.bg-orb {
    position: fixed;
    border-radius: 50%;
    filter: blur(2px);
    z-index: -1;
    animation: drift 12s ease-in-out infinite;
}

.orb-1 {
    width: 420px;
    height: 420px;
    top: -130px;
    right: -120px;
    background: rgba(213, 95, 58, 0.2);
}

.orb-2 {
    width: 320px;
    height: 320px;
    bottom: -120px;

    left: -100px;
    background: rgba(242, 184, 114, 0.2);
    animation-delay: 2s;
}

.auth-shell {
    width: min(1000px, 92vw);
    margin: 0 auto;
    min-height: 90svh;
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 40px;
    align-items: center;
    padding: 24px 0 calc(24px + env(safe-area-inset-bottom));
}

.auth-hero h1 {
    margin: 0;
    font-size: clamp(2.2rem, 4.8vw, 3.7rem);
    line-height: 1.05;
}

.hero-headline-dynamic {
    display: block;
    color: var(--accent-strong);
    transition: opacity 0.22s ease, transform 0.22s ease, filter 0.22s ease;
}

.hero-copy {
    color: var(--muted);
    font-size: 1.05rem;
    max-width: 54ch;
    margin: 18px 0 0;
    transition: opacity 0.22s ease, transform 0.22s ease, filter 0.22s ease;
}

.hero-points {
    margin: 22px 0 0;
    padding-left: 18px;
    display: grid;
    gap: 8px;
    color: #3f342d;
    transition: opacity 0.22s ease, transform 0.22s ease, filter 0.22s ease;
}

.hero-headline-dynamic.is-changing,
.hero-copy.is-changing,
.hero-points.is-changing {
    opacity: 0.08;
    transform: translateY(6px);
    filter: blur(1px);
}

.hero-rotation-dots {
    display: flex;
    gap: 8px;
    margin-top: 18px;
}

.hero-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    border: 0;
    background: rgba(84, 70, 63, 0.2);
    padding: 0;
    cursor: pointer;
    transition: transform 0.2s ease, background-color 0.2s ease;
}

.hero-dot.active {
    background: var(--accent);
    transform: scale(1.18);
}

.hero-dot:hover {
    background: rgba(213, 95, 58, 0.55);
}

.auth-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 24px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(9px);
    padding: 26px;
    opacity: 0;
    transform: translateY(14px);
    animation: reveal 0.7s ease forwards;
    animation-delay: 0.1s;
}

.auth-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    background: #f2ede3;
    border-radius: 14px;
    padding: 6px;
    margin-bottom: 22px;
}

.tab-btn {
    border: 0;
    border-radius: 10px;
    background: transparent;
    font: inherit;
    font-weight: 700;
    padding: 10px;
    color: #73584d;
    cursor: pointer;
}

.tab-btn.active {
    background: #fff;
    color: var(--text);
}

.auth-form {
    display: grid;
    gap: 9px;
}

.auth-form label {
    font-size: 0.9rem;
    color: #54463f;
}

.auth-form input,
.message-form input,
.stack-form input,
.stack-form select,
.stack-form textarea {
    width: 100%;
    border: 1px solid #d9cdbf;
    border-radius: 12px;
    padding: 12px 14px;
    font: inherit;
    background: #fffdfa;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.auth-form input:focus,
.message-form input:focus,
.stack-form input:focus,
.stack-form select:focus,
.stack-form textarea:focus {
    border-color: #d0804b;
    box-shadow: 0 0 0 4px rgba(213, 95, 58, 0.14);
    outline: none;
}

.primary-btn,
.ghost-btn {
    border: 0;
    border-radius: 12px;
    font: inherit;
    font-weight: 700;
    padding: 12px 14px;
    cursor: pointer;
}

.primary-btn {
    background: linear-gradient(135deg, var(--accent) 0%, #e5804a 100%);
    color: #fff;
    margin-top: 6px;
}

.primary-btn:hover {
    filter: brightness(1.03);
}

.ghost-btn {
    background: #f3ece0;
    color: #5f4f46;
    border: 1px solid #e3d7c8;
}

.status-message {
    min-height: 24px;
    margin: 10px 2px 0;
    font-size: 0.95rem;
}

.status-message.ok {
    color: var(--ok);
}

.status-message.error {
    color: var(--error);
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 8px 0 4px;
    color: var(--muted);
    font-size: 0.85rem;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border, #e0e0e0);
}

.google-signin-box {
    display: flex;
    justify-content: center;
    min-height: 44px;
}

.google-fallback-link {
    display: block;
    text-align: center;
    text-decoration: none;
}

.muted-note {
    color: var(--muted);
    margin-top: 0;
}

.status-chip {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 999px;
    background: #f3ece0;
    color: #5f4f46;
    font-weight: 600;
    margin: 8px 0 14px;
}

.status-chip.ok {
    background: #eef9f1;
    color: #1f6a3c;
}

.stack-box {
    border: 1px solid #e3d7c8;
    border-radius: 14px;
    padding: 14px;
    margin: 12px 0;
    display: grid;
    gap: 8px;
    background: #fffdfa;
}

.inline-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.captcha-image {
    width: 200px;
    max-width: 100%;
    height: 64px;
    border: 1px solid #d9cdbf;
    border-radius: 10px;
    background: #fff;
}

.qr-image {
    width: 180px;
    height: 180px;
    border-radius: 10px;
    border: 1px solid #e3d7c8;
    background: #fff;
}

.qr-login-panel {
    margin-top: 12px;
    padding: 12px;
    border: 1px dashed #d8c8b7;
    border-radius: 14px;
    background: #fffdfa;
    display: grid;
    justify-items: start;
    gap: 10px;
}

.qr-login-panel .qr-image {
    width: 220px;
    height: 220px;
}

.passkey-list {
    list-style: none;
    padding: 0;
    margin: 12px 0 0;
    display: grid;
    gap: 10px;
}

.passkey-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    border: 1px solid #e3d7c8;
    border-radius: 12px;
    padding: 10px 12px;
    background: #fffdfa;
}

.passkey-empty {
    border: 1px dashed #d8c8b7;
    border-radius: 12px;
    padding: 10px 12px;
    color: #6e6259;
    background: #fffdfa;
}

.hidden {
    display: none;
}

.notice-toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: min(92vw, 640px);
    z-index: 30;
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid #e2d5c8;
    background: #fff;
    box-shadow: var(--shadow);
    font-weight: 600;
    text-align: center;
    animation: reveal 0.25s ease forwards;
}

.notice-toast.ok {
    border-color: rgba(45, 138, 81, 0.3);
    background: #eef9f1;
    color: #1f6a3c;
}

.notice-toast.error {
    border-color: rgba(179, 48, 61, 0.28);
    background: #fff0f2;
    color: #8e2132;
}

.chat-page {
    padding: 18px;
}

.chat-shell {
    width: min(1240px, 100%);
    margin: 0 auto;
    display: grid;
    grid-template-columns: 320px 1fr;
    min-height: calc(100vh - 36px);
    gap: 16px;
}

.chat-sidebar,
.chat-main {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 22px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(9px);
}

.chat-sidebar {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.brand-wrap h1 {
    margin: 8px 0 0;
    font-size: 2rem;
}

.user-pill {
    background: #f6ecdc;
    border: 1px solid #eadbc2;
    border-radius: 999px;
    padding: 8px 12px;
    color: #654f41;
    font-size: 0.92rem;
}

.sidebar-section {
    display: grid;
    gap: 10px;
    min-height: 0;
    flex: 1;
}

.sidebar-section h2,
.chat-header h2 {
    margin: 0;
    font-size: 1.1rem;
}

.rooms-list {
    display: grid;
    gap: 8px;
    overflow: auto;
}

.room-item {
    text-align: left;
    border: 1px solid #e2d5c8;
    border-radius: 11px;
    background: #fff;
    font: inherit;
    padding: 10px 12px;
    cursor: pointer;
    color: #45352f;
}

.room-item.has-unread {
    border-color: #d55f3a;
    box-shadow: inset 0 0 0 1px rgba(213, 95, 58, 0.18);
}

.room-unread-badge {
    margin-left: 0.45rem;
    display: inline-flex;
    min-width: 1.15rem;
    height: 1.15rem;
    padding: 0 0.35rem;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: #d55f3a;
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1;
}

.room-item:hover,
.room-item.active {
    background: #fff1e5;
    border-color: #deac82;
}

.chat-main {
    display: grid;
    grid-template-rows: auto 1fr auto;
    min-height: 0;
}

.chat-header {
    padding: 18px 20px;
    border-bottom: 1px solid var(--line);
}

.typing-indicator {
    margin: 6px 0 0;
    font-size: 0.84rem;
    color: #7a675b;
    font-style: italic;
}

.room-presence {
    margin: 4px 0 0;
    font-size: 0.8rem;
    color: #8a7467;
}

.chat-notification-toggle {
    margin: 6px 0 0;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    color: #7a675b;
    user-select: none;
}

.chat-notification-toggle input {
    width: 0.95rem;
    height: 0.95rem;
}

.room-unread-attention {
    margin: 4px 0 0;
    font-size: 0.8rem;
    color: #b0482a;
    font-weight: 700;
}

.messages-list {
    overflow: auto;
    padding: 16px;
    display: grid;
    align-content: start;
    gap: 10px;
}

.message-item {
    background: #fbf9f6;
    border: 1px solid #ece3d9;
    border-radius: 14px;
    padding: 10px 12px;
    max-width: min(760px, 92%);
}

.message-item.own {
    justify-self: end;
    background: #fff2e9;
    border-color: #e5b58b;
}

.message-item p {
    margin: 4px 0 0;
    white-space: pre-wrap;
}

.message-meta {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    font-size: 0.84rem;
    color: #715f54;
}

.message-author-line {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    min-width: 0;
}

.user-status-icons {
    display: inline-flex;
    gap: 0.2rem;
    align-items: center;
}

.user-status-icon {
    width: 1.15rem;
    height: 1.15rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    border: 1px solid #e3d7c8;
    background: #f7f1e7;
    font-size: 0.72rem;
    line-height: 1;
}

.user-status-icon.active {
    background: #e8f7ee;
    border-color: #b5dfc4;
}

.user-status-icon.inactive {
    background: #efefef;
    border-color: #d7d7d7;
}

.user-status-icon.verified {
    background: #eef5ff;
    border-color: #c8d8f0;
}

.user-status-icon.vip {
    background: #fff4e2;
    border-color: #f0d2a1;
}

.user-status-icon.admin {
    background: #f4edff;
    border-color: #d8c3f0;
}

.user-status-icon.device {
    background: #eef3f9;
    border-color: #c6d3e3;
}

.message-form {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 10px;
    align-items: end;
    padding: 14px;
    border-top: 1px solid var(--line);
}

.message-input-wrap {
    position: relative;
    min-width: 0;
}

.message-emoji-btn {
    margin-top: 0;
    min-width: 2.85rem;
}

#messageCancelEditBtn {
    grid-column: 3;
}

.message-emoji-picker {
    position: absolute;
    left: 0;
    bottom: calc(100% + 8px);
    z-index: 15;
    width: min(270px, 85vw);
    padding: 8px;
    border: 1px solid #e3d5c6;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(81, 49, 25, 0.16);
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 6px;
}

.message-emoji-picker.hidden {
    display: none;
}

.message-emoji-chip {
    border: 1px solid #eadbca;
    border-radius: 10px;
    background: #fff9f3;
    cursor: pointer;
    font-size: 1.05rem;
    line-height: 1;
    padding: 6px;
}

.message-emoji-chip:hover {
    background: #fff0e1;
    border-color: #deac82;
}

.message-reactions {
    display: grid;
    gap: 6px;
    margin-top: 8px;
    position: relative;
}

.message-reaction-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.message-reaction-btn {
    border: 1px solid #e6d8c8;
    border-radius: 999px;
    background: #fffdf9;
    color: #6f594d;
    padding: 4px 8px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font: inherit;
    font-size: 0.82rem;
    cursor: pointer;
}

.message-reaction-btn:hover {
    border-color: #deac82;
    background: #fff2e5;
}

.message-reaction-btn.active {
    border-color: #d0804b;
    background: #ffe7d4;
    color: #5b402f;
}

.message-reaction-btn small {
    min-width: 0.65rem;
    text-align: center;
    font-size: 0.72rem;
    line-height: 1;
    color: #7f6759;
}

.message-reaction-open-btn {
    border: 1px dashed #d9c4ad;
    border-radius: 999px;
    background: #fffaf4;
    color: #7a5f50;
    padding: 4px 9px;
    font: inherit;
    font-size: 0.85rem;
    line-height: 1;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transform: translateY(1px);
    transition: opacity 0.16s ease, transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.message-reaction-open-btn:hover {
    border-color: #d0804b;
    background: #fff1e3;
}

.message-item:hover .message-reaction-open-btn,
.message-item:focus-within .message-reaction-open-btn,
.message-reactions:focus-within .message-reaction-open-btn {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.message-reaction-picker {
    position: absolute;
    left: 0;
    top: calc(100% + 2px);
    z-index: 12;
    width: min(252px, 70vw);
    padding: 7px;
    border: 1px solid #e3d5c6;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(81, 49, 25, 0.16);
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
}

.message-reaction-picker.hidden {
    display: none;
}

.message-reaction-picker-btn {
    border: 1px solid #eadbca;
    border-radius: 10px;
    background: #fff9f3;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    padding: 6px;
}

.message-reaction-picker-btn:hover {
    background: #fff0e1;
    border-color: #deac82;
}

.message-reaction-picker-btn.active {
    border-color: #d0804b;
    background: #ffe7d4;
}

@media (max-width: 720px) {
    .message-form {
        grid-template-columns: 1fr auto;
    }

    .message-emoji-btn {
        grid-column: 2;
    }

    #messageSubmitBtn {
        grid-column: 2;
    }

    #messageCancelEditBtn {
        grid-column: 2;
    }

    .message-reaction-open-btn {
        opacity: 1;
        pointer-events: auto;
        transform: none;
    }
}

.feature-page {
    padding: 24px;
}

.feature-shell {
    width: min(1080px, 100%);
    margin: 0 auto;
    display: grid;
    gap: 18px;
}

.feature-header {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 20px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(9px);
    padding: 18px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.feature-header h1 {
    margin: 6px 0 0;
}

.top-nav {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.top-nav a {
    text-decoration: none;
    color: #5d4a3f;
    border: 1px solid #e2d5c8;
    border-radius: 10px;
    background: #fff;
    padding: 8px 12px;
    font-weight: 700;
}

.top-nav a.active {
    background: #fff1e5;
    border-color: #deac82;
}

.vertical-nav {
    display: grid;
}

.feature-card,
.inline-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(9px);
    padding: 16px;
}

.inline-card h3 {
    margin: 0 0 10px;
}

.stack-form {
    display: grid;
    gap: 10px;
}

.avatar-editor {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 14px;
    align-items: start;
}

.profile-avatar-preview,
.public-profile-avatar {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border-radius: 50%;
    border: 1px solid #ddc9b5;
    background: #fff;
}

.avatar-controls {
    display: grid;
    gap: 8px;
}

.file-like-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: fit-content;
    cursor: pointer;
}

.hidden-input {
    display: none;
}

.privacy-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: #6e6259;
}

.stack-form input[type="checkbox"],
.stack-form input[type="radio"] {
    width: auto;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.privacy-row {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.privacy-help {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 1px solid #cdb8a6;
    color: #7a675b;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    cursor: help;
    user-select: none;
}

.profile-completion {
    border: 1px solid #e6d7c8;
    border-radius: 12px;
    padding: 10px 12px;
    background: #fffefb;
    display: grid;
    gap: 8px;
}

.profile-completion-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    color: #5e4c42;
    font-size: 0.92rem;
}

.profile-completion-bar {
    width: 100%;
    height: 10px;
    border-radius: 999px;
    background: #eee3d7;
    overflow: hidden;
}

.profile-completion-fill {
    height: 100%;
    width: 0;
    border-radius: 999px;
    background: linear-gradient(90deg, #d55f3a 0%, #e5804a 100%);
    transition: width 0.25s ease;
}

.item-completion-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 8px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    border: 1px solid #e4d1c0;
    background: #f7efe6;
    color: #7f6858;
}

.item-completion-badge.filled {
    border-color: rgba(45, 138, 81, 0.4);
    background: #eef9f1;
    color: #1f6a3c;
}

.item-completion-badge.empty {
    border-color: rgba(179, 48, 61, 0.34);
    background: #fff2f4;
    color: #8e2132;
}

.extended-item.has-empty-subsections {
    border-color: #e6bfc4;
    background: #fff9fa;
}

.public-extended-item.is-incomplete {
    border-color: #e8c4c8;
    background: #fff8f9;
}

.stack-form textarea {
    resize: vertical;
}

.extended-profile-grid {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.extended-item {
    border: 1px solid #e6d7c8;
    border-radius: 14px;
    padding: 12px;
    background: #fffaf4;
    display: grid;
    gap: 8px;
}

.extended-item.hidden {
    display: none;
}

.extended-item h4 {
    margin: 0;
}

.section-toggle {
    width: 100%;
    border: 1px solid #e2d2c3;
    border-radius: 10px;
    background: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    font-weight: 700;
    color: #5f4a3f;
    cursor: pointer;
}

.section-toggle-indicator {
    font-size: 1.2rem;
    line-height: 1;
}

.section-body {
    display: grid;
    gap: 8px;
}

.section-pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border: 1px solid #e7d9cb;
    border-radius: 12px;
    padding: 10px 12px;
    background: #fffefb;
}

.section-pager .muted-note {
    margin: 0;
}

.compact-form {
    gap: 8px;
}

.compact-form .primary-btn,
.compact-form .ghost-btn {
    margin-top: 0;
    padding: 10px 12px;
}

.horizontal-form {
    grid-template-columns: 1fr auto;
    align-items: center;
}

.invite-panel {
    border-bottom: 1px solid var(--line);
    padding: 10px 14px;
}

.invite-list {
    display: grid;
    gap: 8px;
}

.invite-item {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    border: 1px solid #e4d8ca;
    border-radius: 12px;
    padding: 10px;
    background: #fff9f2;
}

.invite-item p {
    margin: 0;
    font-size: 0.9rem;
}

.invite-item span {
    color: #7a675b;
}

.status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 600;
    white-space: nowrap;
}

.status-active {
    background: #d4edda;
    color: #155724;
}

.status-unverified {
    background: #fff3cd;
    color: #856404;
}

.status-banned {
    background: #f8d7da;
    color: #721c24;
}

.status-noprofile {
    background: #e2e3e5;
    color: #383d41;
}

.status-admin {
    background: #cce5ff;
    color: #004085;
}

.section-title {
    margin: 0 0 10px;
}

.discover-filter-bar {
    display: grid;
    gap: 10px;
    margin-bottom: 10px;
}

.discover-filter-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 8px;
    align-items: center;
}

/* Radio / checkbox option groups in extended profile form */
.option-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 0;
    max-height: 260px;
    overflow-y: auto;
}

.option-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: 1px solid #d4b8a4;
    border-radius: 999px;
    background: #fdf8f5;
    cursor: pointer;
    font-size: 0.9rem;
    line-height: 1.2;
    transition: background 0.15s, border-color 0.15s;
    user-select: none;
}

.option-pill:hover {
    background: #f5e6d8;
    border-color: #c0896a;
}

.option-pill input[type="radio"],
.option-pill input[type="checkbox"] {
    accent-color: #c0896a;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    cursor: pointer;
}

/* Requirement matrix (U protějšku požaduji) */
.requirement-matrix {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
    margin: 4px 0 12px;
}

.requirement-matrix th,
.requirement-matrix td {
    padding: 6px 8px;
    text-align: center;
    border-bottom: 1px solid #ecddd3;
}

.requirement-matrix th:first-child,
.requirement-matrix td:first-child {
    text-align: left;
    font-weight: normal;
}

.requirement-matrix thead th {
    font-weight: 600;
    background: #fdf0e6;
    color: #7a4520;
}

.requirement-matrix tbody tr:hover {
    background: #fdf8f5;
}

.requirement-matrix input[type="radio"] {
    accent-color: #c0896a;
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.discover-filter-form input,
.discover-filter-form select {
    border: 1px solid #e0c8b3;
    border-radius: 10px;
    padding: 8px 10px;
    font-size: 0.9rem;
    background: #fff;
}

.discover-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 12px;
}

.discover-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(9px);
    padding: 14px;
    display: grid;
    gap: 8px;
}

.discover-avatar-wrap {
    display: flex;
    justify-content: center;
}

.discover-avatar {
    width: 84px;
    height: 84px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid #dec9b5;
    background: #fff;
}

.discover-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 10px;
}

.discover-name-line {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    min-width: 0;
}

.discover-head h3 {
    margin: 0;
}

.discover-head span {
    color: #7e5f4b;
    font-weight: 700;
    font-size: 0.85rem;
}

.discover-meta {
    color: #7a675b;
    margin: 0;
}

.discover-actions {
    margin-top: 4px;
}

.discover-actions .primary-btn:disabled {
    opacity: 0.6;
    cursor: default;
}

.ghost-btn:disabled,
.primary-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.matches-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.match-pill {
    background: #fff3e4;
    border: 1px solid #e5c29f;
    border-radius: 999px;
    padding: 8px 12px;
    font-weight: 700;
    color: #654f41;
}

.match-pill-link {
    text-decoration: none;
    transition: transform 0.14s ease, box-shadow 0.14s ease;
}

.match-pill-link:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 20px rgba(41, 26, 15, 0.1);
}

.public-profile-body {
    display: grid;
    gap: 12px;
}

.public-profile-body p {
    margin: 6px 0 0;
    white-space: pre-wrap;
}

.public-extended-grid {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.public-extended-item {
    border: 1px solid #e7d8c8;
    border-radius: 12px;
    background: #fffaf4;
    overflow: hidden;
}

.public-extended-item.hidden {
    display: none;
}

.public-extended-item summary {
    cursor: pointer;
    padding: 10px 12px;
    font-weight: 700;
    color: #614e42;
}

.public-extended-item p {
    margin-top: 8px;
}

.public-extended-item-content {
    padding: 0 12px 12px;
    display: grid;
    gap: 6px;
}

.empty-state {
    margin: 0;
    color: #7d6a5f;
}

@media (max-width: 940px) {
    .auth-page {
        min-height: 100svh;
    }

    .auth-shell {
        grid-template-columns: 1fr;
        min-height: auto;
        align-items: start;
        padding: 20px 0 calc(26px + env(safe-area-inset-bottom));
        gap: 22px;
    }

    .auth-card {
        margin-bottom: env(safe-area-inset-bottom);
    }

    .chat-shell {
        grid-template-columns: 1fr;
    }

    .chat-sidebar {
        order: 2;
    }

    .chat-main {
        order: 1;
        min-height: 65vh;
    }

    .feature-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .horizontal-form {
        grid-template-columns: 1fr;
    }

    .avatar-editor {
        grid-template-columns: 1fr;
    }
}

@keyframes reveal {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes drift {

    0%,
    100% {
        transform: translateY(0) scale(1);
    }

    50% {
        transform: translateY(12px) scale(1.05);
    }
}

/* ===== Basic profile fieldset styles ===== */
.basic-fieldset {
    border: 1px solid #e2d2c3;
    border-radius: 12px;
    padding: 16px 18px 12px;
    margin: 16px 0;
    background: #fffaf5;
}

.basic-fieldset legend {
    color: #7a5c45;
    font-weight: 700;
    font-size: 0.95rem;
    padding: 0 4px;
}

.bpf-row {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 8px 12px;
    align-items: start;
    margin-bottom: 12px;
}

@media (max-width: 600px) {
    .bpf-row {
        grid-template-columns: 1fr;
    }
}

.bpf-label {
    font-weight: 600;
    color: #5f4a3f;
    padding-top: 6px;
    font-size: 0.92rem;
}

.bpf-ctrl {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.bpf-ctrl select {
    max-width: 320px;
}

.bpf-hint {
    margin: 4px 0 0;
    font-size: 0.82rem;
    color: #8a7268;
    grid-column: 1 / -1;
}

.radio-inline,
.checkbox-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 18px;
    align-items: center;
    padding-top: 4px;
}

.radio-inline label,
.checkbox-inline label {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    font-size: 0.93rem;
    font-weight: 400;
}

.date-inline {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
    padding-top: 2px;
}

.date-sel {
    width: 70px;
}

.year-sel {
    width: 90px;
}

.range-inline {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
    padding-top: 4px;
}

.range-num {
    width: 80px;
    padding: 6px 8px;
    border: 1px solid #d6c4b0;
    border-radius: 8px;
    font-size: 0.93rem;
    background: #fff;
}

.char-counter {
    font-size: 0.82rem;
    color: #8a7268;
    margin-top: 4px;
}

.bpf-block-opts {
    display: grid;
    gap: 8px;
    margin: 12px 0 16px;
}

.bpf-block-opts label {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    line-height: 1.45;
}

/* ===== Profile incomplete banner ===== */
.profile-incomplete-banner {
    background: #fff3cd;
    border: 1px solid #f0c040;
    border-left: 4px solid #e09a00;
    border-radius: 10px;
    padding: 12px 18px;
    margin: 0 0 16px;
    color: #6b4e00;
    font-size: 0.92rem;
    line-height: 1.5;
}

.profile-incomplete-banner strong {
    display: block;
    margin-bottom: 3px;
}

/* ===== Profile gate in discover ===== */
.profile-gate {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px 24px;
    border: 2px dashed #e2cdb5;
    border-radius: 16px;
    background: #fffaf3;
    color: #6b4e2a;
}

.profile-gate-icon {
    font-size: 2.5rem;
    margin: 0 0 8px;
}

.profile-gate h3 {
    margin: 0 0 10px;
    font-size: 1.2rem;
}

.profile-gate p {
    max-width: 420px;
    margin: 0 auto 18px;
    font-size: 0.92rem;
    color: #8a6545;
}