:root {
    color-scheme: light;
    --bg: #f6f7ff;
    --bg-strong: #ffffff;
    --surface: #ffffff;
    --surface-2: #eef1ff;
    --text: #111827;
    --muted: #65708a;
    --border: #dfe4f7;
    --primary: #1e3a8a;
    --primary-strong: #172554;
    --primary-soft: #dbe7ff;
    --pink: #ec4899;
    --pink-soft: #fde7f3;
    --indigo: #8b5cf6;
    --indigo-soft: #eee7ff;
    --ink: #111416;
    --danger: #d94b4b;
    --shadow: 0 24px 80px rgba(27, 31, 34, .12);
    --shadow-soft: 0 14px 36px rgba(27, 31, 34, .08);
    --radius: 8px;
    --radius-lg: 22px;
    --topbar: 70px;
    --bottom-nav: 74px;
    --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

html[data-theme="dark"] {
    color-scheme: dark;
    --bg: #050816;
    --bg-strong: #081124;
    --surface: #0d1730;
    --surface-2: #15203d;
    --text: #f7f8ff;
    --muted: #a7b0cf;
    --border: #24304f;
    --primary: #60a5fa;
    --primary-strong: #bfdbfe;
    --primary-soft: #102a52;
    --pink: #f472b6;
    --pink-soft: #3a1530;
    --indigo: #a78bfa;
    --indigo-soft: #261b4b;
    --ink: #f8faf7;
    --danger: #ff7777;
    --shadow: 0 30px 90px rgba(0, 0, 0, .42);
    --shadow-soft: 0 16px 42px rgba(0, 0, 0, .28);
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

.grecaptcha-badge {
    visibility: hidden !important;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.profile-top h1 {
    display: flex;
    align-items: center;
}

.verified-badge {
    margin-left: .35rem;
}

h1 .verified-badge {
    font-size: .7em;
}

html {
    min-height: 100%;
    background: var(--bg);
}

body {
    min-height: 100%;
    margin: 0;
    background:
        linear-gradient(180deg, color-mix(in srgb, var(--primary-soft), transparent 25%), transparent 420px),
        var(--bg);
    color: var(--text);
    font-family: var(--font);
    line-height: 1.5;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

.app-shell {
    min-height: 100vh;
    padding-bottom: calc(var(--bottom-nav) + env(safe-area-inset-bottom));
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    height: var(--topbar);
    padding: 0 clamp(16px, 4vw, 42px);
    border-bottom: 1px solid color-mix(in srgb, var(--border), transparent 25%);
    background: color-mix(in srgb, var(--bg-strong), transparent 10%);
    backdrop-filter: blur(18px);
}

.brand,
.top-actions,
.profile-top,
.message-meta,
.section-head,
.hero-actions,
.trust-row,
.share-grid,
.message-actions,
.profile-link-row {
    display: flex;
    align-items: center;
}

.brand {
    gap: 10px;
    font-size: 1.08rem;
    font-weight: 800;
    letter-spacing: 0;
}

.brand-mark,
.avatar {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    color: #fff;
    font-weight: 850;
}

.avatar {
    overflow: hidden;
    border-radius: 999px;
    background: var(--primary-soft);
}

.brand-mark img,
.logo-avatar img {
    width: 78%;
    height: 78%;
    display: block;
    object-fit: contain;
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar.large {
    width: 52px;
    height: 52px;
    font-size: 1.35rem;
}

.avatar.jumbo {
    width: 84px;
    height: 84px;
    font-size: 2rem;
}

.top-actions {
    gap: 10px;
    margin-left: auto;
}

.top-menu {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 18px;
    margin-right: auto;
}

.top-menu .top-menu-link {
    min-height: 40px;
    padding: 0 8px;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    font-size: .88rem;
}

.top-menu .top-menu-link.active {
    border: 0;
    background: transparent;
    color: var(--primary-strong);
}

.install-prompt {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 4px 5px 4px 12px;
    border: 1px solid color-mix(in srgb, var(--border), transparent 18%);
    border-radius: 999px;
    background: color-mix(in srgb, var(--surface), transparent 8%);
    box-shadow: var(--shadow-soft);
}

.install-prompt[hidden] {
    display: none !important;
}

.install-suggestion {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--muted);
    font-size: .82rem;
    font-weight: 850;
    white-space: nowrap;
}

.install-suggestion i {
    color: var(--primary-strong);
    font-size: .92rem;
}

.install-prompt[data-install-ready="true"] {
    border-color: color-mix(in srgb, var(--primary), transparent 58%);
    background: color-mix(in srgb, var(--primary-soft), var(--surface) 54%);
}

.install-prompt[data-install-ready="true"] .install-suggestion {
    color: var(--text);
}

.install-app-button {
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 0 13px;
    border: 1px solid transparent;
    border-radius: 999px;
    background: var(--primary);
    color: #fff;
    font-size: .86rem;
    font-weight: 850;
    white-space: nowrap;
    box-shadow: 0 10px 22px color-mix(in srgb, var(--primary), transparent 72%);
    transition: transform .18s ease, filter .18s ease, background .18s ease, box-shadow .18s ease;
}

.install-app-button i {
    font-size: .86rem;
}

.install-label-short {
    display: none;
}

.mobile-only {
    display: none;
}

.icon-button.mobile-only {
    display: none;
}

.mobile-public-menu {
    position: fixed;
    inset: 0;
    z-index: 41;
    pointer-events: none;
    opacity: 0;
    transition: opacity .2s ease;
}

.mobile-public-menu[hidden] {
    display: block !important;
    visibility: hidden;
}

.mobile-public-menu.is-open {
    opacity: 1;
    visibility: visible;
}

.mobile-public-menu-backdrop {
    display: none;
}

.mobile-public-panel {
    position: absolute;
    top: var(--topbar);
    left: 0;
    right: 0;
    bottom: 0;
    width: auto;
    display: grid;
    grid-template-rows: auto 1fr auto;
    background: color-mix(in srgb, var(--bg-strong), transparent 2%);
    box-shadow: var(--shadow);
    pointer-events: auto;
    overflow: hidden;
    transform: translateX(100%);
    opacity: 0;
    transition: transform .24s ease, opacity .24s ease;
}

.mobile-public-menu.is-open .mobile-public-panel {
    transform: translateX(0);
    opacity: 1;
}

.mobile-public-home-entry {
    min-height: 62px;
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    padding: 0 14px;
    border-bottom: 1px solid color-mix(in srgb, var(--border), transparent 18%);
    font-size: 1.02rem;
    font-weight: 820;
}

.mobile-public-home-entry.active {
    color: var(--primary-strong);
}

.mobile-public-menu-links {
    display: grid;
    align-content: start;
    padding: 0 14px;
}

.mobile-public-menu-links a {
    min-height: 56px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 0 2px;
    border-bottom: 1px solid color-mix(in srgb, var(--border), transparent 22%);
    font-size: 1.03rem;
    font-weight: 820;
}

.mobile-public-menu-links a.active {
    color: var(--primary-strong);
}

.mobile-public-menu-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
    border-top: 1px solid color-mix(in srgb, var(--border), transparent 14%);
}

.mobile-login-link {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 1.06rem;
    font-weight: 850;
}

.mobile-login-link.active {
    color: var(--primary-strong);
}

.mobile-menu-theme-toggle {
    width: 42px;
    height: 42px;
}

.icon-button.mobile-only i {
    transition: transform .2s ease;
}

.icon-button.mobile-only[aria-expanded="true"] i {
    transform: rotate(90deg);
}

.app-main {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
    padding: clamp(10px, 1vw, 20px) 0;
    outline: none;
}

.flash-stack {
    position: fixed;
    top: calc(var(--topbar) + 12px);
    right: 16px;
    z-index: 40;
    display: grid;
    gap: 10px;
    width: min(360px, calc(100% - 32px));
}

.toast {
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-soft);
    color: var(--text);
    cursor: pointer;
    font-weight: 700;
    transition: opacity .18s ease, transform .18s ease;
}

.toast-warning {
    border-left-color: var(--indigo);
}

.primary-button,
.secondary-button,
.small-button,
.ghost-link,
.share-button,
.icon-pill,
.message-actions button,
.rules-link {
    min-height: 44px;
    border-radius: var(--radius);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 800;
    border: 1px solid transparent;
    transition: transform .18s ease, background .18s ease, border-color .18s ease, color .18s ease;
}

.primary-button,
.small-button {
    padding: 0 20px;
    background: var(--primary);
    color: #fff;
    box-shadow: 0 12px 28px color-mix(in srgb, var(--primary), transparent 68%);
}

.primary-button:hover,
.small-button:hover,
.share-button:hover,
.secondary-button:hover,
.message-actions button:hover,
.icon-pill:hover {
    transform: translateY(-1px);
}

.secondary-button,
.ghost-link,
.rules-link {
    padding: 0 18px;
    border-color: var(--border);
    background: color-mix(in srgb, var(--surface), transparent 8%);
    color: var(--text);
}

.secondary-button.small {
    min-height: 38px;
    padding: 0 14px;
    font-size: .92rem;
}

.full {
    width: 100%;
}

.icon-button {
    position: relative;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: var(--surface);
    color: var(--text);
}

/* Unified interaction feedback for touch, mouse, and keyboard users. */
:where(
    .primary-button,
    .secondary-button,
    .small-button,
    .ghost-link,
    .icon-button,
    .install-app-button,
    .rules-link,
    .profile-link-tool,
    .owner-link-tool,
    .message-card-link,
    .message-step-button,
    .story-theme-button,
    .story-fullscreen-tool,
    .share-story-icon-button,
    .share-mode-toggle,
    .share-card-actions button,
    .bottom-nav a
) {
    transition: transform .14s ease, box-shadow .18s ease, filter .18s ease, background .18s ease, color .18s ease, border-color .18s ease;
    transform: translateZ(0);
}

@media (hover: hover) {
    :where(
        .primary-button,
        .secondary-button,
        .small-button,
        .ghost-link,
        .icon-button,
        .install-app-button,
        .rules-link,
        .profile-link-tool,
        .owner-link-tool,
        .message-card-link,
        .message-step-button,
        .story-theme-button,
        .story-fullscreen-tool,
        .share-story-icon-button,
        .share-mode-toggle,
        .share-card-actions button,
        .bottom-nav a
    ):hover {
        filter: brightness(1.06);
    }
}

:where(
    .primary-button,
    .secondary-button,
    .small-button,
    .ghost-link,
    .icon-button,
    .install-app-button,
    .rules-link,
    .profile-link-tool,
    .owner-link-tool,
    .message-card-link,
    .message-step-button,
    .story-theme-button,
    .story-fullscreen-tool,
    .share-story-icon-button,
    .share-mode-toggle,
    .share-card-actions button,
    .bottom-nav a
):focus-visible {
    outline: 2px solid color-mix(in srgb, var(--primary), transparent 25%);
    outline-offset: 2px;
}

:where(
    .primary-button,
    .secondary-button,
    .small-button,
    .ghost-link,
    .icon-button,
    .install-app-button,
    .rules-link,
    .profile-link-tool,
    .owner-link-tool,
    .message-card-link,
    .message-step-button,
    .story-theme-button,
    .story-fullscreen-tool,
    .share-story-icon-button,
    .share-mode-toggle,
    .share-card-actions button,
    .bottom-nav a
):active {
    transform: translateY(1px) scale(.97);
}

.nav-icon,
.success-mark,
.empty-mark {
    display: inline-block;
    position: relative;
}

.theme-icon {
    font-size: 1.05rem;
    line-height: 1;
}

.theme-toggle .theme-icon {
    grid-area: 1 / 1;
}

.theme-toggle .theme-icon-moon {
    display: none !important;
}

html[data-theme="dark"] .theme-toggle .theme-icon-sun {
    display: none !important;
}

html[data-theme="dark"] .theme-toggle .theme-icon-moon {
    display: inline-block !important;
}

.hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(320px, .72fr);
    gap: clamp(28px, 5vw, 70px);
    align-items: center;
    min-height: calc(100vh - var(--topbar) - var(--bottom-nav) - 80px);
}

.hero-copy h1,
.auth-copy h1,
.profile-panel h1,
.section-head h1,
.error-page h1,
.public-profile h1 {
    margin: 0;
    color: var(--ink);
    font-size: clamp(2.4rem, 7vw, 5.6rem);
    line-height: .96;
    letter-spacing: 0;
}

.section-head h1,
.profile-panel h1,
.public-profile h1 {
    font-size: clamp(1rem, 3vw, 2rem);
}

.section-head h2 {
    margin: 0;
    font-size: clamp(1.35rem, 3vw, 2rem);
}

.eyebrow {
    margin: 0 0 12px;
    color: var(--primary-strong);
    font-size: .78rem;
    font-weight: 900;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.hero-text,
.auth-copy p,
.profile-prompt,
.empty-state p,
.error-page p {
    max-width: 640px;
    color: var(--muted);
    font-size: clamp(1.05rem, 2.2vw, 1.35rem);
}

.hero-actions {
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 28px;
}

.trust-row {
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 28px;
}

.trust-row span {
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--muted);
    font-size: .92rem;
}

.trust-row strong {
    color: var(--text);
}

.phone-preview,
.auth-card,
.profile-panel,
.settings-card,
.composer-card,
.success-panel,
.rules-card,
.message-card,
.empty-state,
.error-page {
    border: 1px solid var(--border);
    background: color-mix(in srgb, var(--surface), transparent 0%);
    box-shadow: var(--shadow);
}

.phone-preview {
    display: grid;
    gap: 16px;
    padding: 18px;
    border-radius: 30px;
    min-height: 560px;
    align-content: start;
}

.preview-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
}

.preview-header strong,
.preview-header span {
    display: block;
}

.preview-header span,
.preview-card span {
    color: var(--muted);
    font-size: .9rem;
}

.message-composer-preview,
.preview-card {
    border-radius: var(--radius-lg);
    padding: 22px;
}

.message-composer-preview {
    min-height: 190px;
    background: var(--surface-2);
}

.message-composer-preview p {
    margin: 0 0 28px;
    font-size: 1.3rem;
    font-weight: 850;
}

.preview-lines {
    display: grid;
    gap: 10px;
}

.preview-lines span {
    display: block;
    height: 12px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--muted), transparent 72%);
}

.preview-lines span:nth-child(2) {
    width: 78%;
}

.preview-lines span:nth-child(3) {
    width: 54%;
}

.preview-card {
    display: grid;
    gap: 4px;
    background: var(--primary-soft);
}

.preview-card.pink {
    background: var(--pink-soft);
}

.feature-strip {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin-top: 44px;
}

.feature-strip article {
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: color-mix(in srgb, var(--surface), transparent 8%);
}

.feature-strip h2 {
    margin: 10px 0 8px;
    font-size: 1.05rem;
}

.feature-strip p {
    margin: 0;
    color: var(--muted);
}

.feature-dot {
    display: block;
    width: 34px;
    height: 6px;
    border-radius: 999px;
}

.blue-dot {
    background: var(--primary);
}

.pink-dot {
    background: var(--pink);
}

.indigo-dot {
    background: var(--indigo);
}

.auth-wrap {
    display: grid;
    grid-template-columns: minmax(0, .8fr) minmax(320px, 430px);
    gap: clamp(24px, 5vw, 72px);
    align-items: center;
}

.auth-card,
.settings-card,
.composer-card {
    display: grid;
    gap: 18px;
    padding: clamp(18px, 4vw, 28px);
    border-radius: var(--radius-lg);
}

.settings-card-head {
    display: grid;
    gap: 3px;
}

.settings-card-head h2,
.settings-card-head p {
    margin: 0;
}

.settings-card-head h2 {
    font-size: 1.15rem;
}

.settings-card-head p {
    color: var(--muted);
    font-weight: 750;
}

.unified-settings-card {
    gap: 0;
}

.settings-section-form {
    display: grid;
    gap: 18px;
    margin: 0;
}

.input-action-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
}

.input-action-row button {
    min-width: 104px;
}

button:disabled {
    cursor: not-allowed;
    opacity: .52;
    transform: none !important;
}

label {
    display: grid;
    gap: 8px;
    font-weight: 800;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-strong);
    color: var(--text);
    outline: none;
    transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

input {
    min-height: 52px;
    padding: 0 14px;
}

select {
    min-height: 52px;
    padding: 0 42px 0 14px;
    appearance: none;
    background-image:
        linear-gradient(45deg, transparent 50%, var(--muted) 50%),
        linear-gradient(135deg, var(--muted) 50%, transparent 50%);
    background-position:
        calc(100% - 19px) 50%,
        calc(100% - 13px) 50%;
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
}

.password-field {
    position: relative;
    display: block;
}

.password-field input {
    padding-right: 52px;
}

.password-toggle {
    position: absolute;
    top: 50%;
    right: 8px;
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border: 1px solid transparent;
    border-radius: 50%;
    background: transparent;
    color: var(--muted);
    transform: translateY(-50%);
    transition: color .18s ease, background .18s ease;
}

.password-toggle:hover,
.password-toggle:focus-visible {
    color: var(--text);
    background: color-mix(in srgb, var(--surface), transparent 8%);
}

textarea {
    resize: vertical;
    min-height: 180px;
    padding: 14px;
    font-weight: 400;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary), transparent 82%);
}

.field-error,
.form-error {
    color: var(--danger);
}

.field-feedback {
    min-height: 1.35em;
    color: var(--muted);
    font-size: .92rem;
    font-weight: 800;
}

.field-feedback.good {
    color: var(--primary);
}

.field-feedback.bad {
    color: var(--ink);
}

.otp-box {
    display: grid;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: color-mix(in srgb, var(--surface-2), transparent 32%);
}

.otp-meta {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
}

.otp-resend {
    min-height: 38px;
}

.reset-flow-card {
    position: relative;
    --reset-step-ms: 210ms;
    transition: opacity var(--reset-step-ms) cubic-bezier(.22, .61, .36, 1), transform var(--reset-step-ms) cubic-bezier(.22, .61, .36, 1);
}

.reset-flow-card.is-transitioning {
    opacity: .84;
    transform: translateY(2px) scale(.996);
    pointer-events: none;
}

.reset-step {
    display: grid;
    gap: 16px;
    animation: pageEnter calc(var(--reset-step-ms) + 40ms) cubic-bezier(.22, .61, .36, 1) both;
}

@media (max-width: 620px) {
    .reset-flow-card {
        --reset-step-ms: 150ms;
    }

    .reset-flow-card.is-transitioning {
        opacity: .9;
        transform: translateY(1px);
    }
}

.form-error {
    margin: 0;
    padding: 12px 14px;
    border: 1px solid color-mix(in srgb, var(--danger), transparent 55%);
    border-radius: var(--radius);
    background: color-mix(in srgb, var(--danger), transparent 90%);
    font-weight: 800;
}

.fine-print {
    margin: 0;
    color: var(--muted);
    text-align: center;
}

.fine-print a,
.section-head a,
.rules-link {
    color: var(--primary-strong);
}

.dashboard,
.messages-page,
.settings-page,
.rules-page,
.legal-page,
.contact-page,
.public-profile {
    display: grid;
    gap: 22px;
}

.legal-card h2 {
    margin: 28px 0 12px;
    color: var(--ink);
    font-size: clamp(1.25rem, 2.2vw, 1.55rem);
    line-height: 1.2;
    font-weight: 860;
}

.legal-card p {
    margin: 0 0 14px;
    color: var(--muted);
    font-weight: 700;
}

.legal-card ul {
    margin: 0 0 20px;
    padding-left: 20px;
    color: var(--muted);
    font-weight: 700;
}

.legal-card > p:first-of-type {
    margin-bottom: 20px;
    color: var(--text);
    font-size: clamp(1.05rem, 1.6vw, 1.18rem);
    font-weight: 780;
}

.contact-page .contact-card {
    max-width: 700px;
}

.auth-wrap .auth-card + .auth-card {
    margin-top: 14px;
}

.profile-panel {
    padding: clamp(18px, 4vw, 30px);
    border-radius: var(--radius-lg);
}

.profile-panel.public {
    box-shadow: var(--shadow-soft);
}

.profile-top {
    gap: 16px;
}

.muted {
    margin: 3px 0 0;
    color: var(--muted);
}

.profile-link-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
    margin-top: 22px;
}

.profile-link-field {
    min-height: 46px;
    display: flex;
    align-items: stretch;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg-strong);
    overflow: hidden;
}

.profile-link-row input {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    padding: 0 14px;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.profile-link-tools {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    border-left: 1px solid color-mix(in srgb, var(--border), transparent 18%);
    background: transparent;
}

.profile-link-tool {
    width: 36px;
    min-height: 44px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--muted);
    transition: background .18s ease, color .18s ease;
}

.profile-link-tool + .profile-link-tool {
    border-left: 1px solid color-mix(in srgb, var(--border), transparent 20%);
}

.profile-link-tool:hover {
    background: color-mix(in srgb, var(--primary-soft), transparent 10%);
    color: var(--primary-strong);
}

.profile-link-tool:focus-visible {
    outline: 2px solid color-mix(in srgb, var(--primary), transparent 30%);
    outline-offset: 1px;
}

.profile-link-tool i {
    font-size: 1rem;
}

.icon-pill {
    padding: 0 16px;
    border-color: var(--border);
    background: var(--surface-2);
    color: var(--text);
}

.icon-pill.icon-only {
    width: 46px;
    min-width: 46px;
    padding: 0;
    font-size: 1rem;
}

.share-grid {
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 16px;
}

.share-button {
    padding: 0 16px;
    border: 0;
    background: var(--ink);
    color: var(--bg-strong);
}

.share-button.whatsapp {
    background: linear-gradient(90deg, var(--primary), var(--pink));
    color: #fff;
}

.owner-profile-card {
    max-width: 660px;
    margin: 0 auto;
    padding: clamp(20px, 4vw, 34px);
    display: grid;
    gap: 18px;
    border-radius: 26px;
    border: 1px solid color-mix(in srgb, var(--border), transparent 18%);
    background:
        linear-gradient(160deg, color-mix(in srgb, var(--surface), transparent 6%), color-mix(in srgb, var(--surface-2), transparent 10%)),
        radial-gradient(circle at 20% -8%, color-mix(in srgb, var(--primary), transparent 78%), transparent 46%),
        radial-gradient(circle at 90% -20%, color-mix(in srgb, var(--pink), transparent 84%), transparent 45%);
    box-shadow: var(--shadow);
}

.owner-profile-summary {
    display: grid;
    gap: 14px;
}

.owner-profile-summary .profile-prompt {
    max-width: 560px;
    margin: 0;
    font-size: clamp(1rem, 2vw, 1.14rem);
}

.owner-action-note {
    grid-column: 1 / -1;
    margin: 0;
    color: var(--muted);
    font-size: 1.04rem;
    line-height: 1.45;
}

.owner-link-row {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
}

.owner-link-field {
    min-height: 46px;
    display: flex;
    align-items: stretch;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg-strong);
    overflow: hidden;
}

.owner-link-row input {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    padding: 0 14px;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    font-weight: 400;
    color: var(--muted);
}

.owner-link-tools {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    border-left: 1px solid color-mix(in srgb, var(--border), transparent 18%);
    background: transparent;
}

.owner-link-tool {
    width: 36px;
    min-height: 44px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--muted);
    transition: background .18s ease, color .18s ease;
}

.owner-link-tool + .owner-link-tool {
    border-left: 1px solid color-mix(in srgb, var(--border), transparent 20%);
}

.owner-link-tool:hover {
    background: color-mix(in srgb, var(--primary-soft), transparent 10%);
    color: var(--primary-strong);
}

.owner-link-tool:focus-visible {
    outline: 2px solid color-mix(in srgb, var(--primary), transparent 30%);
    outline-offset: 1px;
}

.owner-link-tool i {
    font-size: 1rem;
}

@media (min-width: 841px) {
    body.route-own-profile .app-main {
        padding-top: 10px;
        padding-bottom: 10px;
    }

    .public-profile-owner {
        width: 100%;
        min-height: calc(100dvh - var(--topbar) - var(--bottom-nav) - 24px);
        display: grid;
        align-content: center;
    }

    .public-profile-owner .owner-profile-card {
        margin-block: auto;
    }
}

.owner-action-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: color-mix(in srgb, var(--bg-strong), transparent 5%);
}

.owner-action {
    width: 100%;
    min-height: 62px;
    display: grid;
    grid-template-columns: 46px 1fr;
    align-items: center;
    padding: 0 16px;
    border: 1px solid color-mix(in srgb, var(--border), transparent 10%);
    border-radius: 16px;
    background: transparent;
    color: var(--text);
    font-weight: 700;
    text-align: left;
    letter-spacing: 0;
    transition: transform .18s ease, border-color .18s ease, background .18s ease;
}

.owner-action:hover {
    transform: translateY(-1px);
    border-color: color-mix(in srgb, var(--primary), var(--border) 45%);
    background: color-mix(in srgb, var(--surface), transparent 30%);
}

.owner-action-icon {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: color-mix(in srgb, var(--surface), transparent 20%);
    color: var(--text);
    font-weight: 900;
    font-size: 1.08rem;
}

.owner-view {
    background: transparent;
}

.owner-share {
    background: transparent;
}

.share-popup-backdrop {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: grid;
    place-items: center;
    padding: max(18px, env(safe-area-inset-top)) 20px max(20px, env(safe-area-inset-bottom));
    overflow: hidden;
    overscroll-behavior: none;
    color: #fff;
    background: linear-gradient(145deg, #f9d84b 0%, #f28d35 38%, #ef2e73 100%);
    isolation: isolate;
    cursor: pointer;
}

.share-popup {
    position: relative;
    z-index: 1;
    width: min(760px, 100%);
    height: min(900px, calc(100vh - 40px));
    height: min(900px, calc(100dvh - 40px));
    min-height: 0;
    display: grid;
    grid-template-rows: auto 1fr auto;
    align-items: center;
    gap: clamp(12px, 2.8vh, 28px);
    cursor: default;
}

.share-story-top {
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr) 52px;
    align-items: center;
    gap: 12px;
}

.share-story-icon-button,
.share-mode-toggle {
    min-height: 48px;
    border: 2px solid currentColor;
    background: transparent;
    color: currentColor;
    font-weight: 900;
}

.share-story-icon-button {
    width: 52px;
    display: grid;
    place-items: center;
    border: 0;
    font-size: 2.2rem;
}

.share-mode-toggle {
    justify-self: center;
    min-width: 118px;
    padding: 0 22px;
    border-radius: 999px;
    font-size: 1rem;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.share-card-stage {
    width: 100%;
    display: grid;
    place-items: center;
}

.share-card-canvas {
    width: min(520px, calc(100vw - 48px), max(320px, calc(100vh - 246px)));
    width: min(520px, calc(100vw - 48px), max(320px, calc(100dvh - 246px)));
    max-width: 100%;
    aspect-ratio: 1;
    display: block;
    border-radius: 36px;
    box-shadow: 0 26px 70px rgba(0, 0, 0, .16);
}

.share-card-actions {
    width: auto;
    justify-self: center;
    display: inline-flex;
    align-items: center;
    border: 1px solid currentColor;
    border-radius: 999px;
    background: transparent;
    box-shadow: var(--shadow-soft);
    overflow: hidden;
}

.share-card-actions button {
    width: 72px;
    min-height: 58px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: inherit;
    box-shadow: none;
    font: inherit;
    transition: background .18s ease, color .18s ease;
}

.share-card-actions button + button {
    border-left: 1px solid color-mix(in srgb, currentColor, transparent 55%);
}

.share-card-actions button:hover {
    background: color-mix(in srgb, currentColor, transparent 85%);
}

.share-card-actions i {
    font-size: 1.5rem;
}

.share-popup-backdrop[data-share-mode="emoji"] {
    color: #222;
    background: #fff;
}

.share-emoji-wall {
    display: none;
    position: absolute;
    inset: -90px -70px;
    z-index: 0;
    white-space: pre;
    font-size: 92px;
    line-height: 1.7;
    letter-spacing: 72px;
    transform: rotate(-12deg);
    pointer-events: none;
}

.share-popup-backdrop[data-share-mode="emoji"] .share-emoji-wall {
    display: block;
}

.share-emoji-sheet {
    position: absolute;
    left: 50%;
    bottom: max(12px, env(safe-area-inset-bottom));
    z-index: 5;
    width: min(700px, calc(100% - 20px));
    max-height: min(620px, 78vh);
    display: grid;
    grid-template-rows: auto auto auto 1fr;
    gap: 14px;
    padding: 18px 20px 24px;
    border-radius: 34px;
    background: color-mix(in srgb, #3f3e38, transparent 4%);
    color: #fff;
    box-shadow: 0 30px 90px rgba(0, 0, 0, .34);
    backdrop-filter: blur(18px);
    transform: translateX(-50%);
    cursor: default;
}

.share-emoji-grabber {
    justify-self: center;
    width: 76px;
    height: 7px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .72);
}

.share-emoji-search {
    display: grid;
    grid-template-columns: 24px 1fr;
    align-items: center;
    gap: 10px;
    min-height: 58px;
    padding: 0 16px;
    border-radius: 16px;
    background: rgba(255, 255, 255, .18);
    color: rgba(255, 255, 255, .86);
    font-size: 1.2rem;
}

.share-emoji-search input {
    min-height: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #fff;
    box-shadow: none;
}

.share-emoji-search input::placeholder {
    color: rgba(255, 255, 255, .78);
}

.share-emoji-sheet p {
    margin: 0;
    font-size: 1.08rem;
    font-weight: 900;
}

.share-emoji-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 10px 14px;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-right: 4px;
}

.share-emoji-option {
    min-height: 62px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 16px;
    background: transparent;
    font-size: clamp(2rem, 6vw, 3.1rem);
    line-height: 1;
    transition: transform .16s ease, background .16s ease;
}

.share-emoji-option:hover,
.share-emoji-option:focus-visible {
    background: rgba(255, 255, 255, .12);
    transform: scale(1.06);
}

.no-scroll {
    overflow: hidden;
}

.logout-popup-backdrop {
    position: fixed;
    inset: 0;
    z-index: 63;
    display: grid;
    place-items: center;
    padding: 20px;
    background: color-mix(in srgb, #0d1317, transparent 30%);
    backdrop-filter: blur(4px);
}

.logout-popup {
    width: min(420px, 100%);
    padding: 22px;
    border-radius: 22px;
    border: 1px solid color-mix(in srgb, var(--primary), transparent 60%);
    background:
        linear-gradient(145deg, color-mix(in srgb, var(--surface), transparent 2%), color-mix(in srgb, var(--surface-2), transparent 8%)),
        radial-gradient(circle at 15% -20%, color-mix(in srgb, var(--primary), transparent 72%), transparent 44%);
    box-shadow: var(--shadow);
    cursor: default;
}

.logout-popup h2 {
    margin: 0;
    color: var(--ink);
    font-size: clamp(1.15rem, 2.6vw, 1.45rem);
    line-height: 1.25;
}

.logout-popup p {
    margin: 10px 0 0;
    color: var(--muted);
    font-weight: 700;
}

.logout-popup-actions {
    margin-top: 18px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.logout-popup-actions .primary-button,
.logout-popup-actions .secondary-button {
    min-height: 40px;
    min-width: 82px;
}

.report-popup-backdrop {
    z-index: 10001;
}

.report-popup .primary-button {
    background: #dc2626;
    box-shadow: 0 12px 28px rgba(220, 38, 38, .24);
}

.rules-popup-backdrop {
    position: fixed;
    inset: 0;
    z-index: 62;
    display: grid;
    place-items: center;
    padding: 20px;
    background: color-mix(in srgb, #0d1317, transparent 28%);
    backdrop-filter: blur(4px);
}

.rules-popup {
    width: min(620px, 100%);
    border-radius: 26px;
    border: 1px solid color-mix(in srgb, var(--primary), transparent 62%);
    background:
        linear-gradient(145deg, color-mix(in srgb, var(--surface), transparent 2%), color-mix(in srgb, var(--surface-2), transparent 8%)),
        radial-gradient(circle at 20% -15%, color-mix(in srgb, var(--primary), transparent 68%), transparent 42%),
        radial-gradient(circle at 92% 0%, color-mix(in srgb, var(--pink), transparent 76%), transparent 38%);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.rules-popup-header,
.rules-popup-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid color-mix(in srgb, var(--border), transparent 35%);
}

.rules-popup-header h2 {
    margin: 0;
    color: var(--ink);
    font-size: 1.7rem;
    letter-spacing: 0;
}

.rules-popup-close {
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 50%;
    background: color-mix(in srgb, var(--surface-2), var(--primary-soft) 35%);
    color: var(--text);
    font-size: 1.35rem;
    font-weight: 900;
    line-height: 1;
}

.rules-popup-close:focus-visible,
.share-popup-close:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--primary), transparent 45%);
    outline-offset: 3px;
}

.rules-popup-body {
    padding: 20px;
}

.rules-popup-body p {
    margin: 0;
    color: var(--muted);
    font-size: 1.02rem;
    font-weight: 700;
}

.rules-popup-body ul {
    margin: 16px 0 0;
    padding: 0;
    display: grid;
    gap: 9px;
    list-style: none;
}

.rules-popup-body li {
    position: relative;
    min-height: 48px;
    display: flex;
    align-items: center;
    padding: 12px 14px 12px 44px;
    border: 1px solid color-mix(in srgb, var(--border), transparent 28%);
    border-radius: 14px;
    background: color-mix(in srgb, var(--bg-strong), transparent 8%);
    color: var(--text);
    font-weight: 760;
}

.rules-popup-body li::before {
    content: "!";
    position: absolute;
    left: 14px;
    width: 20px;
    height: 20px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--pink-soft);
    color: var(--pink);
    font-size: .78rem;
    font-weight: 950;
}

.rules-popup-footer {
    border-top: 1px solid color-mix(in srgb, var(--border), transparent 35%);
    border-bottom: 0;
    justify-content: flex-end;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.stat-grid article {
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}

.stat-grid strong,
.stat-grid span {
    display: block;
}

.stat-grid strong {
    font-size: clamp(1.6rem, 5vw, 2.6rem);
    line-height: 1;
}

.stat-grid span {
    margin-top: 6px;
    color: var(--muted);
    font-weight: 750;
}

.pagination-gap {
    min-width: 28px;
    height: 40px;
    display: inline-grid;
    place-items: center;
    color: var(--muted);
    font-weight: 900;
}

.section-head {
    justify-content: space-between;
    gap: 14px;
}

.section-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.section-head .eyebrow {
    margin-bottom: 4px;
}

.message-list {
    display: grid;
    gap: 14px;
}

.pagination {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin: 20px auto 0;
    padding: 8px;
    border: 1px solid color-mix(in srgb, var(--border), transparent 30%);
    border-radius: 18px;
    background: color-mix(in srgb, var(--surface), transparent 10%);
    box-shadow: var(--shadow-soft);
}

.pagination a {
    min-width: 40px;
    height: 40px;
    display: inline-grid;
    place-items: center;
    border: 1px solid transparent;
    border-radius: 12px;
    color: var(--muted);
    font-size: .94rem;
    font-weight: 900;
    transition: background .18s ease, border-color .18s ease, color .18s ease, transform .18s ease;
}

.pagination a:hover {
    transform: translateY(-1px);
    border-color: color-mix(in srgb, var(--primary), transparent 45%);
    background: var(--primary-soft);
    color: var(--primary-strong);
}

.pagination a.active {
    border-color: color-mix(in srgb, var(--primary), transparent 35%);
    background: linear-gradient(135deg, var(--primary), var(--pink));
    color: #fff;
    box-shadow: 0 10px 24px color-mix(in srgb, var(--primary), transparent 72%);
}

.message-list.compact {
    grid-template-columns: repeat(3, 1fr);
}

.message-card {
    border-radius: var(--radius-lg);
    padding: 18px;
    box-shadow: var(--shadow-soft);
}

.message-card p {
    margin: 0;
    color: var(--text);
    font-size: 1.04rem;
    overflow-wrap: anywhere;
}

.message-card > span,
.message-meta {
    color: var(--muted);
    font-size: .88rem;
    font-weight: 750;
}

.message-card > span {
    display: inline-block;
    margin-top: 14px;
}

.message-meta {
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.message-state-pill {
    margin-left: 8px;
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid color-mix(in srgb, var(--border), transparent 25%);
    font-size: .7rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .04em;
    display: inline-flex;
    align-items: center;
    line-height: 1.1;
}

.message-state-pill.reported {
    border-color: color-mix(in srgb, #dc2626, transparent 30%);
    background: color-mix(in srgb, #dc2626, transparent 86%);
    color: #dc2626;
}

.message-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 16px;
}

.message-actions button,
.message-actions a {
    min-height: 38px;
    padding: 0 12px;
    border-radius: var(--radius);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: .9rem;
    font-weight: 850;
}

.message-report-form {
    margin: 0;
}

.danger-button {
    min-height: 42px;
    padding: 0 16px;
    border-radius: var(--radius);
    border: 1px solid color-mix(in srgb, #dc2626, transparent 35%);
    background: color-mix(in srgb, #dc2626, transparent 90%);
    color: #dc2626;
    font-weight: 900;
}

.danger-button:hover {
    transform: translateY(-1px);
}

.danger-button:disabled {
    opacity: .65;
    transform: none;
    cursor: not-allowed;
}

.message-actions button {
    border-color: var(--border);
    background: var(--surface-2);
    color: var(--text);
}

.message-actions a {
    border: 1px solid var(--primary);
    background: var(--primary-soft);
    color: var(--primary-strong);
}

.message-card-link {
    display: block;
    transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.message-card-link:hover {
    transform: translateY(-2px);
    border-color: color-mix(in srgb, var(--primary), transparent 45%);
    box-shadow: var(--shadow);
}

.message-card.unread {
    border-color: color-mix(in srgb, var(--primary), transparent 42%);
    background: color-mix(in srgb, var(--primary-soft), var(--surface) 84%);
}

.message-card.read {
    opacity: .92;
}

.message-card.reported {
    border-color: color-mix(in srgb, #dc2626, transparent 45%);
    background: color-mix(in srgb, #dc2626, var(--surface) 96%);
}

.inline-form {
    margin: 0;
}

.message-detail {
    display: grid;
    gap: 14px;
    width: min(640px, 100%);
    margin: 0 auto;
}

.detail-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.message-stepper {
    width: min(430px, 100%);
    margin: -2px auto 0;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 10px;
}

.message-step-slot {
    min-height: 42px;
    display: flex;
    justify-content: flex-start;
}

.message-step-slot-center {
    justify-content: center;
}

.message-step-slot-next {
    justify-content: flex-end;
}

.story-theme-actions {
    display: inline-flex;
    align-items: center;
    flex-wrap: nowrap;
    white-space: nowrap;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: color-mix(in srgb, var(--surface), transparent 4%);
    box-shadow: var(--shadow-soft);
    overflow: hidden;
}

.story-theme-actions > * {
    flex: 0 0 auto;
}

.message-step-button {
    width: 42px;
    height: 42px;
    display: inline-grid;
    place-items: center;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: color-mix(in srgb, var(--surface), transparent 4%);
    color: var(--text);
    box-shadow: var(--shadow-soft);
    transition: transform .18s ease, border-color .18s ease, background .18s ease;
}

.message-step-button:hover {
    transform: translateY(-1px);
    border-color: color-mix(in srgb, var(--primary), transparent 35%);
    background: var(--primary-soft);
    color: var(--primary-strong);
}

.story-theme-button {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border: 0;
    background: transparent;
    color: var(--text);
    cursor: pointer;
    font: inherit;
    transition: background .18s ease, color .18s ease;
}

.story-theme-button + .story-theme-button {
    border-left: 1px solid color-mix(in srgb, var(--border), transparent 8%);
}

.story-theme-form {
    display: flex;
    flex: 0 0 auto;
    min-width: 0;
    border-left: 1px solid color-mix(in srgb, var(--border), transparent 8%);
}

.story-theme-button:hover {
    background: var(--primary-soft);
    color: var(--primary-strong);
}

.story-theme-button-report {
    color: #dc2626;
}

.story-theme-button-report:hover {
    background: color-mix(in srgb, #dc2626, transparent 88%);
    color: #dc2626;
}

.story-theme-button-report:disabled {
    opacity: .65;
    cursor: not-allowed;
}

.story-theme-button i {
    font-size: .95rem;
}

.story-palette-swatch {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, .34);
    background: var(--story-palette-preview, linear-gradient(145deg, #1e293b 0%, #111827 42%, #020617 100%));
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .2);
}

.story-message-shell {
    display: grid;
    place-items: center;
    padding: 0;
    background: transparent;
}

.story-message-card {
    --story-card-text: #fff;
    --story-card-muted: rgba(255, 255, 255, .72);
    width: min(430px, 100%);
    min-height: min(660px, calc(100vh - 235px));
    display: grid;
    grid-template-rows: auto 1fr auto;
    gap: 18px;
    padding: clamp(24px, 5vw, 34px);
    border-radius: 30px;
    background:
        linear-gradient(160deg, rgba(5, 8, 22, .98), rgba(23, 37, 84, .95) 58%, rgba(236, 72, 153, .72) 150%),
        radial-gradient(circle at 20% 0%, rgba(96, 165, 250, .24), transparent 36%);
    color: #fff;
    box-shadow: 0 26px 70px rgba(0, 0, 0, .28);
    text-align: left;
    border: 0;
}

.story-message-card.story-message-reported {
    border-color: color-mix(in srgb, #dc2626, transparent 35%);
    background:
        linear-gradient(160deg, rgba(45, 8, 12, .98), rgba(127, 29, 29, .9) 58%, rgba(236, 72, 153, .52) 150%),
        radial-gradient(circle at 20% 0%, rgba(248, 113, 113, .26), transparent 36%);
}

.story-kicker,
.story-message-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: var(--story-card-muted);
    font-size: .82rem;
    font-weight: 850;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.story-kicker > span:first-child {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
    white-space: nowrap;
    min-width: 0;
}

.story-kicker > span:first-child .message-state-pill {
    flex: 0 0 auto;
    margin-left: 0;
}

.story-message-card p {
    align-self: center;
    margin: 0;
    color: var(--story-card-text);
    font-size: clamp(1.95rem, 5vw, 3.1rem);
    font-weight: 900;
    line-height: 1.05;
    overflow-wrap: anywhere;
}

.story-message-card.story-text-medium p {
    font-size: clamp(1.55rem, 4vw, 2.7rem);
}

.story-message-card.story-text-long p {
    font-size: clamp(1.12rem, 3vw, 1.85rem);
    line-height: 1.16;
}

.story-footer-brand {
    display: flex;
    align-items: center;
}

.story-footer-brand img {
    width: 24px;
    height: 24px;
    display: block;
    object-fit: contain;
    margin-right: .35rem;
}

.story-fullscreen-backdrop {
    position: fixed;
    inset: 0;
    width: 100vw;
    width: 100dvw;
    height: 100vh;
    height: 100dvh;
    z-index: 9999;
    display: grid;
    place-items: center;
    padding: clamp(12px, 3vw, 34px);
    background: rgba(2, 6, 23, .9);
    cursor: zoom-out;
}

.story-fullscreen-tools {
    position: absolute;
    top: max(16px, env(safe-area-inset-top));
    right: max(16px, env(safe-area-inset-right));
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: default;
}

.story-fullscreen-report-form {
    margin: 0;
}

.story-fullscreen-tool {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, .22);
    border-radius: 50%;
    background: rgba(15, 23, 42, .72);
    color: #fff;
    box-shadow: 0 16px 34px rgba(0, 0, 0, .32);
    backdrop-filter: blur(12px);
}

.story-fullscreen-tool-report {
    color: #fecaca;
}

.story-fullscreen-tool-report:hover {
    border-color: rgba(248, 113, 113, .52);
    background: rgba(127, 29, 29, .78);
    color: #fff;
}

.story-fullscreen-card {
    width: min(1220px, 100%);
    min-height: calc(100dvh - clamp(24px, 6vw, 68px));
    cursor: default;
}

.story-fullscreen-card p {
    max-width: 980px;
    font-size: clamp(2.1rem, 3vw, 4rem);
    line-height: 1.05;
}

.story-fullscreen-card.story-text-medium p {
    font-size: clamp(1.9rem, 2.55vw, 3.25rem);
}

.story-fullscreen-card.story-text-long p {
    font-size: clamp(1.35rem, 1.75vw, 2.35rem);
    line-height: 1.18;
}

.story-fullscreen-backdrop.is-reporting-out,
.message-detail.is-reporting-out {
    pointer-events: none;
}

.story-fullscreen-backdrop.is-reporting-out .story-fullscreen-card,
.message-detail.is-reporting-out .story-message-shell,
.message-detail.is-reporting-out .message-stepper {
    animation: storyReportOut .26s cubic-bezier(.4, 0, .2, 1) both;
}

.story-fullscreen-backdrop.is-reporting-out .story-fullscreen-tools {
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity .16s ease, transform .16s ease;
}

@keyframes storyReportOut {
    to {
        opacity: 0;
        transform: translateY(18px) scale(.96);
        filter: blur(5px);
    }
}

@media (min-width: 621px) {
    .message-detail {
        width: min(980px, 100%);
    }

    .story-message-card {
        width: min(880px, 100%);
        min-height: min(540px, calc(100vh - 230px));
        padding: clamp(34px, 4vw, 56px);
    }

    .story-message-card p {
        max-width: 760px;
        font-size: clamp(2rem, 3.1vw, 3.25rem);
        line-height: 1.04;
    }

    .story-message-card.story-text-medium p {
        font-size: clamp(1.75rem, 2.45vw, 2.55rem);
        line-height: 1.08;
    }

    .story-message-card.story-text-long p {
        font-size: clamp(1.35rem, 1.7vw, 2rem);
        line-height: 1.18;
    }

    .message-stepper {
        width: min(880px, 100%);
    }
}

.empty-state,
.error-page,
.success-panel {
    display: grid;
    justify-items: start;
    gap: 10px;
    padding: clamp(24px, 5vw, 36px);
    border-radius: var(--radius-lg);
}

.success-panel img {
    width: 100px;
}

.success-panel p {
    display: grid;
    gap: 20px;
}

.empty-mark {
    width: 42px;
    height: 42px;
    border: 2px solid var(--primary);
    border-radius: 12px;
    background:
        linear-gradient(90deg, transparent 45%, var(--primary) 45% 55%, transparent 55%),
        linear-gradient(transparent 45%, var(--primary) 45% 55%, transparent 55%),
        var(--primary-soft);
}

.success-mark {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary);
}

.success-mark::after {
    content: "";
    position: absolute;
    left: 14px;
    top: 12px;
    width: 18px;
    height: 10px;
    border-left: 3px solid #fff;
    border-bottom: 3px solid #fff;
    transform: rotate(-45deg);
}

.profile-prompt {
    margin: 20px 0 0;
}

.composer-card small {
    color: var(--muted);
    font-weight: 700;
}

.check-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.check-row input {
    width: 18px;
    min-height: 18px;
}

.segmented {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin: 0;
    padding: 0;
    border: 0;
}

.segmented legend {
    grid-column: 1 / -1;
    margin-bottom: 2px;
    font-weight: 850;
}

.segmented label {
    position: relative;
    display: block;
}

.segmented input {
    position: absolute;
    inset: 0;
    opacity: 0;
}

.segmented span {
    display: grid;
    place-items: center;
    min-height: 44px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-2);
    font-weight: 850;
}

.segmented input:checked + span {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
}

.rules-grid {
    display: grid;
    grid-template-columns: minmax(0, .8fr) minmax(320px, 1fr);
    gap: 16px;
}

.rules-card {
    border-radius: var(--radius-lg);
    padding: clamp(18px, 4vw, 28px);
}

.rules-card ul {
    display: grid;
    gap: 10px;
    margin: 0;
    padding-left: 22px;
    color: var(--muted);
    font-weight: 700;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 13px 0;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
}

th {
    width: 58%;
    color: var(--text);
}

td {
    color: var(--muted);
    font-weight: 750;
}

.bottom-nav {
    position: fixed;
    left: 50%;
    bottom: max(12px, env(safe-area-inset-bottom));
    z-index: 30;
    display: grid;
    grid-template-columns: repeat(var(--nav-count, 4), minmax(0, 1fr));
    gap: 4px;
    width: min(calc((var(--nav-count, 4) * 112px) + 16px), calc(100% - 24px));
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 26px;
    background: color-mix(in srgb, var(--surface), transparent 4%);
    box-shadow: var(--shadow);
    transform: translateX(-50%);
    backdrop-filter: blur(18px);
}

.bottom-nav a {
    display: grid;
    place-items: center;
    gap: 4px;
    min-height: 52px;
    border-radius: 20px;
    color: var(--muted);
    font-size: .72rem;
    font-weight: 850;
    position: relative;
}

.bottom-nav a.active {
    background: var(--primary-soft);
    color: var(--primary-strong);
}

.nav-icon {
    width: 20px;
    height: 20px;
}

.nav-fa-icon {
    display: inline-block;
    font-size: 17px;
    line-height: 1;
}

.bottom-nav .nav-icon {
    display: none;
}

.home-icon {
    border: 2px solid currentColor;
    border-radius: 6px 6px 4px 4px;
    transform: rotate(45deg) scale(.78);
}

.inbox-icon {
    border: 2px solid currentColor;
    border-radius: 6px;
}

.inbox-icon::after {
    content: "";
    position: absolute;
    left: 3px;
    right: 3px;
    top: 8px;
    border-top: 2px solid currentColor;
}

.nav-badge {
    position: absolute;
    top: 6px;
    right: 16px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: #e11d48;
    color: #fff;
    font-size: .62rem;
    font-weight: 900;
    line-height: 1;
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--surface), transparent 6%);
}

.settings-icon {
    border: 2px solid currentColor;
    border-radius: 50%;
}

.settings-icon::after {
    content: "";
    position: absolute;
    inset: 5px;
    border: 2px solid currentColor;
    border-radius: 50%;
}

.rules-icon {
    border: 2px solid currentColor;
    border-radius: 5px;
}

.rules-icon::after {
    content: "";
    position: absolute;
    left: 5px;
    right: 5px;
    top: 5px;
    box-shadow: 0 4px 0 currentColor, 0 8px 0 currentColor;
    border-top: 2px solid currentColor;
}

.logout-icon {
    border: 2px solid currentColor;
    border-radius: 5px;
}

.logout-icon::before {
    content: "";
    position: absolute;
    left: 4px;
    top: 7px;
    width: 9px;
    border-top: 2px solid currentColor;
}

.logout-icon::after {
    content: "";
    position: absolute;
    right: 3px;
    top: 4px;
    width: 7px;
    height: 7px;
    border-top: 2px solid currentColor;
    border-right: 2px solid currentColor;
    transform: rotate(45deg);
}

.plus-icon::before,
.plus-icon::after {
    content: "";
    position: absolute;
    left: 2px;
    right: 2px;
    top: 9px;
    border-top: 2px solid currentColor;
}

.plus-icon::after {
    transform: rotate(90deg);
}

.user-icon {
    border: 2px solid currentColor;
    border-radius: 50%;
}

.user-icon::after {
    content: "";
    position: absolute;
    left: -3px;
    right: -3px;
    bottom: -9px;
    height: 12px;
    border: 2px solid currentColor;
    border-radius: 12px 12px 0 0;
    border-bottom: 0;
}

.page-enter {
    animation: pageEnter .22s ease both;
}

@keyframes pageEnter {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

@media (min-width: 841px) and (max-width: 1080px) {
    .install-prompt {
        min-height: 40px;
        padding: 0;
        border: 0;
        background: transparent;
        box-shadow: none;
    }

    .install-suggestion {
        display: none;
    }

    .install-app-button {
        min-height: 40px;
        padding: 0 12px;
    }

    .install-label-full {
        display: none;
    }

    .install-label-short {
        display: inline;
    }
}

@media (max-width: 840px) {
    .desktop-only {
        display: none;
    }

    .mobile-only {
        display: grid;
    }

    .icon-button.mobile-only {
        display: grid;
    }

    .hero-grid,
    .auth-wrap,
    .rules-grid {
        grid-template-columns: 1fr;
    }

    .hero-grid {
        min-height: 0;
    }

    .phone-preview {
        min-height: auto;
        border-radius: var(--radius-lg);
    }

    .feature-strip,
    .message-list.compact {
        grid-template-columns: 1fr;
    }

    .public-profile-owner {
        min-height: calc(100dvh - var(--topbar) - var(--bottom-nav) - 24px);
        display: grid;
        align-content: center;
    }

    .public-profile-owner .owner-profile-card {
        margin-block: auto;
    }
}

@media (min-width: 841px) {
    .mobile-public-menu {
        display: none !important;
    }

    .bottom-nav .nav-badge {
        top: 7px;
        left: calc(50% + 10px);
        right: auto;
        transform: translateX(-50%);
    }

    /* Keep the desktop landing above-the-fold without sacrificing readability. */
    body.route-home .app-main {
        padding-top: clamp(16px, 2.2vw, 28px);
        padding-bottom: 10px;
    }

    body.route-home .hero-grid {
        gap: clamp(22px, 3vw, 48px);
        min-height: calc(100dvh - var(--topbar) - var(--bottom-nav) - 44px);
    }

    body.route-home .hero-copy h1 {
        font-size: clamp(2.25rem, 5.25vw, 5rem);
    }

    body.route-home .hero-actions {
        margin-top: 20px;
    }

    body.route-home .phone-preview {
        min-height: 0;
        padding: 16px;
        gap: 12px;
    }

    body.route-home .message-composer-preview,
    body.route-home .preview-card {
        padding: 18px;
    }

    body.route-home .message-composer-preview {
        min-height: 164px;
    }

    body.route-home .message-composer-preview p {
        margin-bottom: 22px;
        font-size: 1.16rem;
    }
}

@media (max-width: 620px) {
    .app-main {
        width: min(100% - 24px, 1120px);
        padding-top: 22px;
    }

    .topbar {
        padding-inline: 14px;
    }

    .topbar .icon-button {
        width: 38px;
        height: 38px;
    }

    .topbar .theme-toggle {
        width: 34px;
        height: 34px;
    }

    .install-prompt {
        min-height: 38px;
        padding: 0;
        border: 0;
        background: transparent;
        box-shadow: none;
    }

    .install-app-button {
        min-height: 38px;
        padding: 0 12px;
    }

    .install-label-full {
        display: none;
    }

    .install-label-short {
        display: inline;
    }

    .top-actions .avatar {
        width: 34px;
        height: 34px;
    }

    .topbar .icon-button i,
    .topbar .theme-toggle .theme-icon {
        font-size: .92rem;
    }

    .hero-copy h1,
    .auth-copy h1 {
        font-size: clamp(2.45rem, 13vw, 4.4rem);
    }

    .hero-actions,
    .share-grid {
        align-items: stretch;
        flex-direction: column;
    }

    .stat-grid {
        grid-template-columns: 1fr;
    }

    .profile-top {
        align-items: flex-start;
    }

    .avatar.jumbo {
        width: 70px;
        height: 70px;
    }

    .section-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .message-actions {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
    }

    .message-actions button,
    .message-actions a {
        width: 100%;
    }

    .detail-toolbar {
        gap: 8px;
    }

    .detail-toolbar .secondary-button,
    .detail-toolbar .primary-button {
        min-height: 40px;
        padding-inline: 12px;
    }

    .message-step-button {
        width: 40px;
        height: 40px;
    }

    .message-detail {
        width: min(420px, 100%);
        min-height: calc(100dvh - var(--topbar) - var(--bottom-nav) - 30px);
        align-content: center;
        gap: 10px;
    }

    .message-detail .story-message-shell .story-message-card {
        width: min(360px, 100%);
        min-height: min(500px, calc(100dvh - 320px));
        gap: 12px;
        padding: clamp(16px, 4.5vw, 22px);
        border-radius: 24px;
    }

    .message-detail .story-message-shell .story-kicker,
    .message-detail .story-message-shell .story-message-footer {
        gap: 8px;
        font-size: .68rem;
        letter-spacing: .03em;
    }

    .message-detail .story-message-shell .story-message-card p {
        font-size: clamp(1.5rem, 8vw, 2.3rem);
        line-height: 1.08;
    }

    .message-detail .story-message-shell .story-message-card.story-text-medium p {
        font-size: clamp(1.25rem, 6.5vw, 1.9rem);
    }

    .message-detail .story-message-shell .story-message-card.story-text-long p {
        font-size: clamp(1rem, 5.3vw, 1.35rem);
        line-height: 1.2;
    }

    .message-detail .story-message-shell .story-footer-brand img {
        width: 20px;
        height: 20px;
    }

    .message-detail .message-stepper {
        width: min(334px, 100%);
        gap: 6px;
    }

    .message-detail .message-step-slot {
        min-height: 34px;
    }

    .message-detail .story-theme-actions {
        border-radius: 14px;
    }

    .message-detail .story-theme-button,
    .message-detail .message-step-button {
        width: 34px;
        height: 34px;
    }

    .message-detail .story-theme-button i,
    .message-detail .message-step-button i {
        font-size: .8rem;
    }

    .message-detail .story-palette-swatch {
        width: 16px;
        height: 16px;
    }

    .story-fullscreen-backdrop {
        padding: 0;
    }

    .story-fullscreen-card {
        width: 100%;
        min-height: 100dvh;
        border-radius: 0;
        padding: clamp(24px, 5vw, 34px);
    }

    .story-fullscreen-card p,
    .story-fullscreen-card.story-text-medium p,
    .story-fullscreen-card.story-text-long p {
        max-width: none;
    }

    .bottom-nav {
        border-radius: 22px;
        width: calc(100% - 14px);
        grid-template-columns: repeat(var(--nav-count, 4), minmax(0, 1fr));
    }

    .bottom-nav a {
        min-height: 50px;
    }

    .bottom-nav a > span:not(.nav-badge) {
        display: none;
    }

    .bottom-nav .nav-fa-icon {
        font-size: 17px;
    }

    .share-popup-backdrop {
        padding-inline: 14px;
    }

    .share-popup {
        height: auto;
        min-height: 100%;
    }

    .share-card-canvas {
        width: min(560px, calc(100vw - 28px), 58vh);
        width: min(560px, calc(100vw - 28px), 58dvh);
    }

    .share-card-actions {
        width: auto;
    }

    .share-card-actions button {
        width: min(32vw, 92px);
        min-height: 54px;
    }

    .owner-action-list {
        grid-template-columns: 1fr;
        padding: 16px;
    }

    .owner-link-row {
        grid-template-columns: 1fr;
    }

    .input-action-row {
        grid-template-columns: 1fr;
    }

    .input-action-row button {
        width: 100%;
    }

    .owner-action {
        min-height: 58px;
    }
}

@media (max-width: 360px) {
    :root {
        --bottom-nav: 60px;
    }

    html {
        font-size: 80%;
        -webkit-text-size-adjust: 100%;
        text-size-adjust: 100%;
    }

    .app-main {
        width: min(100% - 18px, 1120px);
        padding-top: 16px;
    }

    .topbar .icon-button {
        width: 34px;
        height: 34px;
    }

    .topbar .theme-toggle {
        width: 30px;
        height: 30px;
    }

    .install-app-button {
        min-height: 34px;
        padding: 0 10px;
    }

    .top-actions .avatar {
        width: 30px;
        height: 30px;
    }

    .topbar .icon-button i,
    .topbar .theme-toggle .theme-icon {
        font-size: .84rem;
    }

    .message-detail {
        width: min(332px, 100%);
        min-height: calc(100dvh - var(--topbar) - var(--bottom-nav) - 24px);
        align-content: center;
        gap: 8px;
    }

    .message-detail .story-message-shell .story-message-card {
        width: min(320px, 100%);
        min-height: min(430px, calc(100dvh - 340px));
        gap: 10px;
        padding: 14px;
        border-radius: 20px;
    }

    .message-detail .story-message-shell .story-kicker,
    .message-detail .story-message-shell .story-message-footer {
        font-size: .58rem;
        letter-spacing: .02em;
    }

    .message-detail .story-message-shell .story-message-card p {
        font-size: clamp(1.2rem, 7vw, 1.65rem);
    }

    .message-detail .story-message-shell .story-message-card.story-text-medium p {
        font-size: clamp(1rem, 5.8vw, 1.35rem);
    }

    .message-detail .story-message-shell .story-message-card.story-text-long p {
        font-size: .9rem;
        line-height: 1.22;
    }

    .message-detail .story-message-shell .story-footer-brand img {
        width: 16px;
        height: 16px;
    }

    .message-detail .message-stepper {
        width: min(292px, 100%);
        gap: 5px;
    }

    .message-detail .message-step-slot {
        min-height: 30px;
    }

    .message-detail .story-theme-actions {
        border-radius: 12px;
    }

    .message-detail .story-theme-button,
    .message-detail .message-step-button {
        width: 28px;
        height: 28px;
    }

    .message-detail .story-theme-button i,
    .message-detail .message-step-button i {
        font-size: .68rem;
    }

    .message-detail .story-palette-swatch {
        width: 13px;
        height: 13px;
    }

    .auth-wrap {
        gap: 12px;
    }

    .auth-copy {
        display: grid;
        gap: 6px;
    }

    .auth-wrap .auth-copy h1 {
        font-size: clamp(1.45rem, 8vw, 1.95rem);
        line-height: 1.04;
    }

    .auth-wrap .auth-copy p {
        font-size: .82rem;
        line-height: 1.35;
    }

    .dashboard,
    .messages-page,
    .settings-page,
    .rules-page,
    .legal-page,
    .contact-page,
    .public-profile {
        gap: 16px;
    }

    .hero-copy h1,
    .auth-copy h1 {
        font-size: clamp(1.9rem, 10vw, 2.8rem);
    }

    .section-head h1,
    .profile-panel h1,
    .public-profile h1 {
        font-size: clamp(1.35rem, 6.6vw, 1.65rem);
        line-height: 1.08;
    }

    .section-head h2 {
        font-size: clamp(1.05rem, 5.2vw, 1.26rem);
    }

    .eyebrow {
        margin-bottom: 6px;
        font-size: .62rem;
        letter-spacing: .06em;
    }

    .hero-text,
    .auth-copy p,
    .profile-prompt,
    .empty-state p,
    .error-page p,
    .owner-action-note,
    .message-card p,
    .legal-card p,
    .legal-card ul,
    .rules-card ul {
        font-size: .9rem;
    }

    .message-card > span,
    .message-meta,
    .pagination a,
    .field-feedback,
    .bottom-nav a {
        font-size: .72rem;
    }

    .profile-panel,
    .settings-card,
    .composer-card,
    .rules-card,
    .message-card,
    .owner-profile-card {
        padding: 14px;
        border-radius: 18px;
    }

    .auth-card {
        gap: 12px;
        padding: 12px;
        border-radius: 16px;
    }

    .auth-card label,
    .auth-card .primary-a,
    .auth-card .fine-print {
        font-size: .82rem;
    }

    .auth-card .primary-button {
        min-height: 40px;
    }

    .profile-top {
        gap: 12px;
    }

    .avatar.jumbo {
        width: 58px;
        height: 58px;
    }

    .settings-card-head h2 {
        font-size: 1.02rem;
    }

    .settings-card-head p,
    .owner-action,
    .composer-card small {
        font-size: .82rem;
    }

    input,
    select,
    textarea,
    button {
        font-size: .9rem;
    }

    input,
    select {
        min-height: 46px;
        padding: 0 12px;
    }

    textarea {
        min-height: 140px;
        padding: 12px;
    }

    .bottom-nav {
        width: calc(100% - 12px);
        bottom: max(6px, env(safe-area-inset-bottom));
        padding: 6px;
        gap: 2px;
        border-radius: 18px;
        grid-template-columns: repeat(var(--nav-count, 4), minmax(0, 1fr));
    }

    .bottom-nav a {
        min-height: 42px;
        gap: 0;
        border-radius: 14px;
    }

    .bottom-nav .nav-fa-icon {
        display: inline-block;
        font-size: 16px;
    }

    .nav-badge {
        top: 4px;
        left: calc(50% + 8px);
        right: auto;
        min-width: 15px;
        height: 15px;
        padding: 0 4px;
        font-size: .54rem;
        transform: translateX(-50%);
    }
}

.primary-a {
    color: var(--primary);
    font-weight: 600;
}

.primary-a:hover, .primary-a:active {
    color: var(--ink);
}
