:root {
    color-scheme: light;
    --ink: #15171c;
    --muted: #646b78;
    --line: #e8e8e2;
    --paper: #ffffff;
    --wash: #f7f7f3;
    --body-bg:
        radial-gradient(circle at 14% 18%, rgba(239, 184, 74, 0.055), transparent 30%),
        linear-gradient(180deg, #fbfbf8 0%, #f6f7f4 52%, #ffffff 100%);
    --topbar-bg: rgba(255, 255, 255, 0.9);
    --topbar-border: rgba(232, 232, 226, 0.9);
    --topbar-shadow: 0 1px 0 rgba(21, 23, 28, 0.025);
    --nav-active-bg: #ffffff;
    --card-border: rgba(222, 225, 221, 0.92);
    --image-bg: #0f1116;
    --meta-bg: #ffffff;
    --text-soft: #394150;
    --tag-bg: #f7f8fb;
    --tag-border: #dde3ec;
    --tag-color: #253044;
    --tag-hover-bg: #eef3ff;
    --control-bg: #ffffff;
    --control-border: #e8e8e2;
    --tooltip-bg: #15171c;
    --tooltip-color: #ffffff;
    --empty-bg: rgba(255, 255, 255, 0.75);
    --preview-placeholder: #d8dde6;
    --forbidden-icon: #111111;
    --red: #ff4d6d;
    --green: #12a87e;
    --yellow: #efb84a;
    --blue: #3a6ff8;
    --shadow: 0 18px 44px rgba(42, 46, 54, 0.08);
    --soft-shadow: 0 8px 22px rgba(42, 46, 54, 0.07);
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --ink: #f4f7fb;
    --muted: #a7b0be;
    --line: #282b31;
    --paper: #121417;
    --wash: #090a0d;
    --body-bg:
        radial-gradient(circle at 18% 0%, rgba(239, 184, 74, 0.16), transparent 34%),
        linear-gradient(160deg, #08090c 0%, #12100d 44%, #1a1208 100%);
    --topbar-bg: rgba(10, 11, 14, 0.88);
    --topbar-border: rgba(58, 53, 43, 0.76);
    --topbar-shadow: 0 8px 24px rgba(0, 0, 0, 0.24);
    --nav-active-bg: #1c2430;
    --card-border: rgba(58, 53, 43, 0.9);
    --image-bg: #07090d;
    --meta-bg: #121417;
    --text-soft: #d9dee7;
    --tag-bg: #1d2026;
    --tag-border: #343841;
    --tag-color: #eef2f7;
    --tag-hover-bg: #262b34;
    --control-bg: #1d2026;
    --control-border: #343841;
    --tooltip-bg: #f4f7fb;
    --tooltip-color: #15171c;
    --empty-bg: rgba(21, 26, 35, 0.78);
    --preview-placeholder: #2b3443;
    --forbidden-icon: #111111;
    --shadow: 0 22px 54px rgba(0, 0, 0, 0.42);
    --soft-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

html {
    min-height: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    background: var(--body-bg);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body.tutorial-open {
    overflow: hidden;
}

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

button,
input,
select {
    font: inherit;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    min-height: 66px;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 8px clamp(16px, 4vw, 38px);
    background: var(--topbar-bg);
    border-bottom: 1px solid var(--topbar-border);
    box-shadow: var(--topbar-shadow);
    backdrop-filter: blur(18px);
}

.public-topbar {
    justify-content: space-between;
}

body[data-shell="android"] .public-topbar {
    display: none !important;
    min-height: 0 !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    box-shadow: none !important;
    overflow: hidden !important;
}

body[data-shell="android"] .feed-mode-tabs {
    display: none !important;
    min-height: 0 !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    box-shadow: none !important;
    overflow: hidden !important;
}

.topbar-actions {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.brand {
    display: inline-flex;
    align-self: stretch;
    align-items: center;
    gap: 10px;
    min-width: 0;
    font-size: 22px;
    font-weight: 900;
    letter-spacing: 0;
}

.brand-mark {
    display: grid;
    flex: 0 0 50px;
    width: 50px;
    height: 50px;
    place-items: center;
    background: transparent;
    border: 0;
    border-radius: 50%;
    box-shadow: none;
    overflow: hidden;
}

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

.search-wrap {
    position: relative;
}

.public-menu-wrap {
    position: relative;
}

.icon-button {
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    color: var(--ink);
    background: var(--paper);
    border: 1px solid var(--control-border);
    border-radius: 50%;
    box-shadow: none;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.icon-button svg {
    display: block;
    width: 18px;
    height: 18px;
    fill: currentColor;
}

.top-search-form {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    z-index: 30;
    display: flex;
    width: min(360px, calc(100vw - 24px));
    gap: 7px;
    padding: 8px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.top-search-form input {
    min-width: 0;
    flex: 1;
    height: 38px;
    padding: 0 10px;
    color: var(--ink);
    background: var(--control-bg);
    border: 1px solid var(--control-border);
    border-radius: 8px;
}

.top-search-form button {
    height: 38px;
    padding: 0 12px;
    color: #fff;
    background: #1877f2;
    border: 0;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 900;
}

.public-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    z-index: 35;
    display: grid;
    min-width: 172px;
    gap: 4px;
    padding: 8px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.public-menu a,
.public-menu button {
    display: flex;
    min-height: 38px;
    align-items: center;
    padding: 0 11px;
    color: var(--ink);
    background: transparent;
    border: 0;
    border-radius: 8px;
    cursor: pointer;
    font: inherit;
    font-size: 14px;
    font-weight: 850;
    text-align: left;
}

.public-menu a:hover,
.public-menu a:focus-visible,
.public-menu button:hover,
.public-menu button:focus-visible {
    background: var(--nav-active-bg);
    outline: none;
}

.topnav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.topnav a {
    padding: 8px 11px;
    color: var(--muted);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
}

.logout-form {
    margin: 0;
}

.topnav .logout-form button,
.admin-drawer-links .logout-form button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 11px;
    color: var(--muted);
    background: transparent;
    border: 0;
    border-radius: 8px;
    cursor: pointer;
    font: inherit;
    font-size: 14px;
    font-weight: 700;
}

.topnav a.active,
.topnav a:hover,
.topnav .logout-form button:hover,
.topnav .logout-form button:focus-visible {
    color: var(--ink);
    background: var(--nav-active-bg);
    box-shadow: inset 0 0 0 1px var(--line), 0 8px 18px rgba(21, 23, 28, 0.06);
}

.theme-toggle {
    display: grid;
    width: 36px;
    height: 36px;
    min-height: 36px;
    place-items: center;
    padding: 0;
    color: var(--ink);
    background: var(--paper);
    border: 1px solid var(--control-border);
    border-radius: 50%;
    box-shadow: none;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
    transform: translateY(-1px);
    box-shadow: 0 12px 28px rgba(21, 23, 28, 0.14);
}

.theme-toggle-icon {
    display: block;
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2.8;
}

:root[data-theme="dark"] .theme-toggle {
    color: #ffd56a;
}

.app-shell {
    width: min(100%, 1160px);
    margin: 0 auto;
    padding: 20px clamp(12px, 4vw, 30px) 26px;
}

body[data-shell="android"] .app-shell {
    padding-top: 8px;
}

body[data-shell="android"] .feed-view {
    min-height: calc(100vh - 16px);
    min-height: calc(100dvh - 16px);
}

body[data-shell="android"] .tag-feed-view {
    gap: 10px;
}

.feed-view {
    display: grid;
    gap: 12px;
    min-height: calc(100vh - 96px);
    min-height: calc(100dvh - 96px);
    align-items: center;
}

.feed-context {
    width: min(100%, 680px);
    justify-self: center;
}

.feed-mode-tabs {
    display: inline-flex;
    justify-self: center;
    gap: 4px;
    padding: 4px;
    background: var(--paper);
    border: 1px solid var(--card-border);
    border-radius: 999px;
    box-shadow: var(--soft-shadow);
}

.feed-mode-tab {
    min-height: 32px;
    padding: 0 13px;
    color: var(--text-soft);
    background: transparent;
    border: 0;
    border-radius: 999px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 900;
    white-space: nowrap;
}

.feed-mode-tab:hover,
.feed-mode-tab:focus-visible,
.feed-mode-tab.active {
    color: var(--paper);
    background: var(--ink);
    outline: 0;
}

.feed-context h1 {
    margin: 0;
    color: var(--ink);
    font-size: 18px;
    line-height: 1.2;
}

.tag-feed-view {
    align-items: start;
}

.tag-swipe-scope {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 10px;
    align-items: center;
    justify-content: center;
    padding: 10px 12px;
    color: var(--text-soft);
    background: var(--paper);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    box-shadow: var(--soft-shadow);
    font-size: 13px;
    font-weight: 800;
    text-align: center;
}

.tag-swipe-scope strong {
    color: var(--blue);
    font-size: 15px;
    overflow-wrap: anywhere;
}

.tag-swipe-scope small {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.tag-swipe-scope a {
    text-decoration: none;
}

.tag-filter-clear {
    display: inline-grid;
    width: 24px;
    height: 24px;
    place-items: center;
    color: #fff;
    background: var(--ink);
    border-radius: 999px;
    font-size: 14px;
    font-weight: 900;
    line-height: 1;
}

.tag-filter-clear:hover,
.tag-filter-clear:focus-visible {
    color: #fff;
    background: var(--red);
}

.swipe-stage {
    display: grid;
    width: min(100%, 560px);
    grid-template-columns: minmax(0, 560px);
    grid-template-rows: auto auto;
    gap: 3px;
    align-items: center;
    justify-content: center;
    justify-self: center;
}

.deck {
    position: relative;
    display: grid;
    grid-column: 1;
    grid-row: 1;
    width: 100%;
    min-height: 500px;
    min-height: clamp(500px, calc(100dvh - 176px), 690px);
    place-items: center;
}

.meme-card {
    position: relative;
    width: 100%;
    max-width: 560px;
    overflow: hidden;
    background: var(--paper);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    box-shadow: 0 14px 44px rgba(21, 23, 28, 0.08);
    touch-action: auto;
    user-select: text;
    -webkit-user-select: text;
    transform: translate3d(var(--drag-x, 0), var(--drag-y, 0), 0) rotate(var(--drag-rotate, 0deg));
    transition: transform 220ms cubic-bezier(0.2, 0.85, 0.2, 1), opacity 180ms ease;
}

.meme-card.is-moving {
    transition: none;
}

.meme-card.leaving-left {
    opacity: 0;
    transform: translate3d(-140vw, 16px, 0) rotate(-18deg);
}

.meme-card.leaving-right {
    opacity: 0;
    transform: translate3d(140vw, 16px, 0) rotate(18deg);
}

.meme-card.react-like {
    animation: reaction-like 420ms ease;
}

.meme-card.react-skip {
    animation: reaction-skip 420ms ease;
}

.meme-card.react-report {
    animation: reaction-report 460ms ease;
}

@keyframes reaction-like {
    0% {
        transform: translate3d(0, 0, 0) scale(1);
    }

    38% {
        box-shadow: 0 22px 58px rgba(24, 119, 242, 0.28);
        transform: translate3d(10px, -5px, 0) rotate(1.2deg) scale(1.018);
    }

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

@keyframes reaction-skip {
    0% {
        transform: translate3d(0, 0, 0) scale(1);
    }

    38% {
        filter: saturate(0.88);
        box-shadow: 0 18px 44px rgba(24, 119, 242, 0.18);
        transform: translate3d(-10px, 5px, 0) rotate(-1.2deg) scale(0.99);
    }

    100% {
        filter: none;
        transform: translate3d(0, 0, 0) scale(1);
    }
}

@keyframes reaction-report {
    0% {
        transform: translate3d(0, 0, 0) scale(1);
    }

    32% {
        box-shadow: 0 22px 58px rgba(237, 73, 86, 0.28);
        transform: translate3d(0, -8px, 0) rotate(-0.8deg) scale(1.012);
    }

    68% {
        transform: translate3d(0, 4px, 0) rotate(0.5deg) scale(0.996);
    }

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

.image-wrap {
    position: relative;
    display: grid;
    overflow: hidden;
    height: 585px;
    height: clamp(360px, 57dvh, 585px);
    min-height: 360px;
    min-height: clamp(360px, 58dvh, 570px);
    background: var(--image-bg);
    place-items: center;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

.image-wrap img {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    background: var(--image-bg);
}

.swipe-badge {
    position: absolute;
    top: 18px;
    left: 18px;
    z-index: 5;
    display: none;
    padding: 8px 12px;
    color: #fff;
    background: rgba(21, 23, 28, 0.88);
    border: 3px solid rgba(255, 255, 255, 0.86);
    border-radius: 8px;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.32);
    font-size: 22px;
    font-weight: 900;
    letter-spacing: 0;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.34);
    transform: rotate(-10deg);
}

.swipe-badge.show {
    display: block;
}

.swipe-badge.like {
    color: #fff;
    background: rgba(18, 168, 126, 0.94);
}

.swipe-badge.skip {
    color: #fff;
    background: rgba(255, 77, 109, 0.95);
}

.swipe-badge.report {
    color: #15171c;
    background: rgba(239, 184, 74, 0.96);
    border-color: rgba(21, 23, 28, 0.26);
    text-shadow: none;
}

.meme-meta {
    display: grid;
    gap: 9px;
    padding: 11px 14px 14px;
    background: var(--meta-bg);
    touch-action: auto;
    user-select: text;
    -webkit-user-select: text;
}

.meme-description {
    cursor: text;
    pointer-events: auto;
    user-select: text;
    -webkit-user-select: text;
}

.section-head h1,
.upload-panel h1,
.reports-panel h1,
.login-panel h1 {
    margin: 0;
    font-size: 22px;
    line-height: 1.18;
    letter-spacing: 0;
}

.section-head.no-title {
    justify-content: flex-end;
}

.meme-description {
    margin: 0;
    color: var(--text-soft);
    font-size: 13px;
    line-height: 1.36;
    white-space: pre-line;
}

.meme-description.is-collapsed {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.description-toggle {
    justify-self: start;
    min-height: 24px;
    padding: 2px 0;
    color: var(--blue);
    background: transparent;
    border: 0;
    cursor: pointer;
    font-size: 12px;
    font-weight: 800;
}

.tags {
    display: flex;
    min-height: 25px;
    flex-wrap: wrap;
    gap: 6px;
}

.meme-meta .tags {
    order: 0;
}

.tag {
    display: inline-flex;
    min-height: 24px;
    align-items: center;
    padding: 3px 7px;
    color: var(--tag-color);
    background: var(--tag-bg);
    border: 1px solid var(--tag-border);
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    pointer-events: auto;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
}

.tag-more {
    color: var(--tag-color);
    background: var(--tag-bg);
    border-color: var(--tag-border);
    font-weight: 900;
}

.tag:hover {
    color: var(--blue);
    border-color: #bfd0fb;
    background: var(--tag-hover-bg);
}

.action-rail {
    display: flex;
    grid-column: 1;
    grid-row: 2;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    justify-content: center;
    margin-top: -8px;
    padding-top: 0;
}

.meme-meta .action-rail {
    position: absolute;
    top: 50%;
    right: calc(clamp(8px, 2.4vw, 16px) - 10px);
    z-index: 8;
    grid-column: auto;
    grid-row: auto;
    flex-direction: column;
    justify-content: center;
    gap: 10px;
    margin: 0;
    padding: 0;
    transform: translateY(-50%);
}

.hand-action {
    position: relative;
    display: grid;
    width: 34px;
    height: 34px;
    overflow: visible;
    place-items: center;
    padding: 0;
    border: 2px solid rgba(255, 255, 255, 0.96);
    border-radius: 50%;
    color: #111111;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.28), 0 0 0 1px rgba(21, 23, 28, 0.08);
    cursor: pointer;
    line-height: 1;
    touch-action: manipulation;
    transition: color 120ms ease, opacity 150ms ease, transform 180ms ease, background 120ms ease;
}

.action-count {
    position: absolute;
    right: -7px;
    top: -7px;
    display: inline-flex;
    min-width: 18px;
    height: 18px;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    color: #fff;
    background: var(--green);
    border: 2px solid var(--paper);
    border-radius: 999px;
    box-shadow: 0 6px 14px rgba(18, 168, 126, 0.28);
    font-size: 11px;
    font-weight: 900;
    line-height: 1;
}

.hand-action:hover,
.hand-action:focus-visible {
    color: #1877f2;
    background: rgba(255, 255, 255, 0.98);
    transform: scale(1.08);
}

.hand-action:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

.hand-action.is-selected,
.hand-action.is-selected:disabled {
    position: relative;
    z-index: 2;
    color: #1877f2;
    opacity: 1;
    background: rgba(255, 255, 255, 0.98);
    transform: scale(1.5);
    box-shadow: 0 12px 28px rgba(24, 119, 242, 0.28), 0 0 0 2px rgba(255, 255, 255, 0.9);
}

.hand-action.is-muted,
.hand-action.is-muted:disabled,
.hand-action.is-dismissed,
.hand-action.is-dismissed:disabled {
    width: 0;
    min-width: 0;
    height: 0;
    opacity: 0;
    overflow: hidden;
    padding: 0;
    transform: scale(0.2);
    pointer-events: none;
}

.meme-edit-link,
.meme-list-edit {
    justify-self: center;
    color: var(--blue);
    font-size: 13px;
    font-weight: 900;
}

.meme-edit-link {
    justify-self: center;
    margin-top: -2px;
    padding: 4px 8px;
    border-radius: 8px;
    font-size: 12px;
    line-height: 1;
}

.meme-edit-link:hover,
.meme-edit-link:focus-visible {
    background: rgba(24, 119, 242, 0.1);
}

.hand-action.reject,
.hand-action.accept {
    color: #111111;
    background: rgba(255, 255, 255, 0.9);
}

.thumb-icon {
    display: block;
    width: 22px;
    height: 22px;
    fill: currentColor;
}

.hand-action.reject .thumb-icon {
    transform: rotate(180deg);
}

.report-action,
.share-action {
    position: relative;
    display: inline-flex;
    width: 34px;
    height: 34px;
    align-items: center;
    justify-content: center;
    place-items: center;
    padding: 0;
    border: 2px solid rgba(255, 255, 255, 0.96);
    border-radius: 50%;
    color: #111111;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.28), 0 0 0 1px rgba(21, 23, 28, 0.08);
    cursor: pointer;
    line-height: 1;
    touch-action: manipulation;
    transition: color 120ms ease, opacity 150ms ease, transform 180ms ease, background 120ms ease;
}

.report-action {
    color: var(--forbidden-icon);
}

.share-action {
    color: #111111;
}

.share-action:focus-visible {
    background: rgba(255, 255, 255, 0.98);
    transform: scale(1.08);
}

.report-action:focus-visible {
    color: var(--forbidden-icon);
    background: rgba(255, 255, 255, 0.98);
    outline: 3px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.32);
    transform: scale(1.14);
}

:root[data-theme="dark"] .report-action:focus-visible {
    background: rgba(255, 255, 255, 0.98);
    outline-color: rgba(255, 255, 255, 0.38);
}

@media (hover: hover) and (pointer: fine) {
    .share-action:hover {
        background: rgba(255, 255, 255, 0.98);
        transform: scale(1.08);
    }

    .report-action:hover {
        color: var(--forbidden-icon);
        background: rgba(255, 255, 255, 0.98);
        outline: 3px solid rgba(255, 255, 255, 0.4);
        box-shadow: 0 12px 28px rgba(0, 0, 0, 0.32);
        transform: scale(1.14);
    }

    :root[data-theme="dark"] .report-action:hover {
        background: rgba(255, 255, 255, 0.98);
        outline-color: rgba(255, 255, 255, 0.38);
    }
}

.action-icon {
    display: block;
    width: 22px;
    height: 22px;
    fill: currentColor;
}

.forbidden-icon {
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2.45;
}

.report-action::after,
.share-action::after {
    position: absolute;
    right: calc(100% + 10px);
    left: auto;
    top: 50%;
    display: none;
    padding: 6px 8px;
    color: #fff;
    background: var(--tooltip-bg);
    border-radius: 8px;
    box-shadow: 0 10px 24px rgba(21, 23, 28, 0.22);
    content: attr(data-tooltip);
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
    white-space: nowrap;
    transform: translateY(-50%);
}

.report-action::after {
    color: #fff;
    background: #111111;
    border: 1px solid rgba(255, 255, 255, 0.18);
}

.next-preview {
    position: relative;
    display: grid;
    grid-column: 2;
    grid-row: 1;
    width: 92px;
    height: 162px;
    align-content: start;
    justify-items: start;
    overflow: hidden;
    opacity: 1;
    cursor: pointer;
    pointer-events: auto;
    user-select: none;
    -webkit-user-select: none;
}

.next-preview:focus-visible {
    outline: 3px solid rgba(58, 111, 248, 0.55);
    outline-offset: 5px;
}

.next-preview[aria-disabled="true"] {
    cursor: default;
    pointer-events: none;
}

.next-preview::after {
    position: absolute;
    right: 5px;
    top: 50%;
    z-index: 4;
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    color: #262626;
    background: rgba(255, 255, 255, 0.92);
    border: 0;
    border-radius: 50%;
    box-shadow: 0 4px 14px rgba(21, 23, 28, 0.22);
    content: "\203A";
    font-size: 32px;
    font-weight: 700;
    line-height: 1;
    pointer-events: none;
    text-indent: 2px;
    transform: translateY(-50%);
    backdrop-filter: blur(10px);
}

.next-preview[hidden] {
    display: none;
}

.next-preview.is-inline {
    display: flex;
    grid-column: auto;
    grid-row: auto;
    width: min(100%, 190px);
    height: 88px;
    align-items: center;
    justify-content: center;
    justify-self: center;
    margin: -2px 0 1px;
}

.next-preview.is-inline::after {
    right: 4px;
    left: auto;
    top: 50%;
}

.next-preview.is-inline .preview-card {
    flex: 0 0 auto;
    width: 108px;
}

.next-preview.is-inline .preview-card + .preview-card {
    margin-top: 0;
    margin-left: -56px;
}

.next-preview.is-inline .preview-card-1 {
    transform: rotate(-2deg) translateX(-2px);
}

.next-preview.is-inline .preview-card-2 {
    transform: rotate(3deg) scale(0.86);
}

.preview-card {
    position: relative;
    display: grid;
    grid-template-areas: "media";
    width: 124px;
    overflow: hidden;
    background: var(--preview-placeholder);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 12px 26px rgba(21, 23, 28, 0.16);
    pointer-events: none;
    transform-origin: center;
}

.preview-card::before {
    content: "";
    display: block;
    grid-area: media;
    width: 100%;
    aspect-ratio: 1 / 1;
    background: var(--preview-placeholder);
    transition: opacity 140ms ease;
}

.preview-card + .preview-card {
    margin-top: -52px;
}

.preview-card-1 {
    z-index: 2;
    transform: rotate(1.5deg) translateX(-6px);
}

.preview-card-2 {
    z-index: 1;
    opacity: 0.7;
    transform: rotate(-3deg) translateX(10px) scale(0.88);
}

.preview-card img {
    display: block;
    grid-area: media;
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    background: var(--image-bg);
    opacity: 0;
    transition: opacity 140ms ease;
}

.preview-card.is-loaded img {
    opacity: 1;
}

.preview-card.is-loaded::before {
    opacity: 0;
}

.preview-card span {
    display: none;
    max-height: 42px;
    overflow: hidden;
    padding: 8px;
    color: var(--text-soft);
    font-size: 12px;
    font-weight: 800;
    line-height: 1.25;
}

.report-action:hover::after,
.report-action:focus-visible::after,
.share-action:hover::after,
.share-action:focus-visible::after {
    display: block;
}

.report-action:disabled,
.share-action:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

.loading-state,
.empty-state {
    display: grid;
    width: min(100%, 430px);
    min-height: 300px;
    place-items: center;
    padding: 32px;
    color: var(--muted);
    background: var(--empty-bg);
    border: 1px dashed #c9d2df;
    border-radius: 8px;
    font-weight: 700;
    text-align: center;
}

.liked-view {
    display: grid;
    gap: 18px;
}

.meme-list-view {
    display: grid;
    gap: 16px;
    width: min(100%, 880px);
    margin: 0 auto;
}

.tag-page-list {
    margin-top: 18px;
}

.section-head {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 18px;
}

.subtle {
    color: var(--muted);
    font-size: 14px;
}

.liked-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 14px;
}

.meme-list {
    display: grid;
    gap: 12px;
}

.meme-list-item {
    display: grid;
    grid-template-columns: 170px minmax(0, 1fr);
    gap: 14px;
    overflow: hidden;
    background: var(--paper);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    box-shadow: var(--soft-shadow);
}

.meme-list-media {
    display: block;
    min-height: 150px;
    background: var(--image-bg);
}

.meme-list-media img {
    display: block;
    width: 100%;
    height: 100%;
    aspect-ratio: 1 / 1;
    object-fit: contain;
}

.meme-list-body {
    display: grid;
    align-content: start;
    gap: 8px;
    min-width: 0;
    padding: 12px 12px 12px 0;
}

.list-tags {
    min-height: 0;
}

.meme-list-description {
    margin: 0;
    color: var(--text-soft);
    font-size: 13px;
    line-height: 1.36;
}

.meme-list-open {
    justify-self: start;
    color: var(--blue);
    font-size: 13px;
    font-weight: 900;
}

.meme-list-actions,
.liked-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.related-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    align-items: center;
    margin-top: 14px;
    padding: 12px;
    background: var(--paper);
    border: 1px solid var(--card-border);
    border-radius: 8px;
}

.related-tags > span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 900;
}

.public-pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    align-items: center;
    justify-content: center;
    margin-top: 4px;
}

.public-pagination a,
.public-pagination span {
    display: inline-flex;
    min-width: 36px;
    min-height: 36px;
    align-items: center;
    justify-content: center;
    padding: 7px 10px;
    color: var(--ink);
    background: var(--paper);
    border: 1px solid var(--control-border);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 850;
}

.public-pagination .current {
    color: #fff;
    background: var(--blue);
    border-color: var(--blue);
}

.public-pagination .disabled,
.public-pagination .ellipsis {
    color: var(--muted);
    background: var(--control-bg);
}

.public-pagination .disabled {
    opacity: 0.62;
}

.popular-tags-view {
    display: grid;
    gap: 16px;
    width: min(100%, 880px);
    margin: 0 auto;
}

.popular-tags-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(138px, 1fr));
    gap: 10px;
}

.popular-tag {
    display: grid;
    gap: 5px;
    min-height: 72px;
    align-content: center;
    padding: 12px;
    color: var(--tag-color);
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--soft-shadow);
}

.popular-tag:hover {
    color: var(--blue);
    border-color: #bfd0fb;
    background: var(--tag-hover-bg);
}

.popular-tag span {
    overflow-wrap: anywhere;
    font-size: 16px;
    font-weight: 900;
    line-height: 1.1;
}

.popular-tag small {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.liked-item {
    overflow: hidden;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.liked-item img {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    background: var(--image-bg);
}

.liked-media {
    display: block;
}

.grid-tags {
    min-height: 0;
    padding: 11px 11px 12px;
}

.liked-actions {
    padding: 0 11px 12px;
}

.grid-tags .tag {
    min-height: 25px;
    padding: 4px 7px;
    font-size: 12px;
}

.toast {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 50;
    max-width: min(360px, calc(100vw - 36px));
    padding: 12px 14px;
    color: #fff;
    background: #15171c;
    border-radius: 8px;
    box-shadow: var(--shadow);
    font-size: 14px;
    font-weight: 700;
}

.contact-dialog {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(21, 23, 28, 0.34);
}

.contact-dialog[hidden] {
    display: none;
}

.contact-panel {
    position: relative;
    display: grid;
    width: min(100%, 360px);
    gap: 8px;
    padding: 24px;
    color: var(--ink);
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.contact-panel h2,
.contact-panel p {
    margin: 0;
}

.contact-panel h2 {
    font-size: 20px;
    line-height: 1.2;
}

.contact-panel p {
    color: var(--ink);
    font-size: 17px;
    font-weight: 850;
}

.contact-close {
    position: absolute;
    top: 10px;
    right: 10px;
    display: grid;
    width: 32px;
    height: 32px;
    place-items: center;
    color: var(--muted);
    background: var(--control-bg);
    border: 1px solid var(--control-border);
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    font-weight: 900;
    line-height: 1;
}

.contact-close:hover,
.contact-close:focus-visible {
    color: var(--ink);
    outline: 3px solid rgba(24, 119, 242, 0.16);
}

body.contact-open {
    overflow: hidden;
}

.tutorial-overlay {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: grid;
    place-items: center;
    padding: 18px;
    background: rgba(10, 12, 16, 0.62);
    backdrop-filter: blur(8px);
}

.tutorial-panel {
    position: relative;
    display: grid;
    width: min(100%, 430px);
    gap: 14px;
    padding: 22px;
    color: var(--ink);
    background: var(--paper);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
}

.tutorial-close {
    position: absolute;
    right: 10px;
    top: 10px;
    display: grid;
    width: 32px;
    height: 32px;
    place-items: center;
    color: var(--muted);
    background: transparent;
    border: 0;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    font-weight: 900;
}

.tutorial-close:hover,
.tutorial-close:focus-visible {
    color: var(--ink);
    background: rgba(21, 23, 28, 0.08);
}

.tutorial-step-count {
    margin: 0;
    color: var(--blue);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0;
    text-transform: uppercase;
}

.tutorial-panel h2 {
    margin: 0;
    padding-right: 28px;
    color: var(--ink);
    font-size: 24px;
    line-height: 1.12;
}

.tutorial-panel p {
    margin: 0;
}

#tutorial-copy {
    color: var(--text-soft);
    font-size: 15px;
    line-height: 1.45;
}

.tutorial-cues {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tutorial-cues span {
    display: inline-flex;
    min-height: 28px;
    align-items: center;
    padding: 5px 9px;
    color: var(--tag-color);
    background: var(--tag-bg);
    border: 1px solid var(--tag-border);
    border-radius: 8px;
    font-size: 12px;
    font-weight: 900;
}

.tutorial-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 4px;
}

.tutorial-primary,
.tutorial-secondary {
    min-height: 38px;
    padding: 0 13px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 900;
}

.tutorial-primary {
    color: #fff;
    background: #15171c;
    border: 1px solid #15171c;
}

.tutorial-secondary {
    color: var(--ink);
    background: var(--control-bg);
    border: 1px solid var(--control-border);
}

.primary-button {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    padding: 0 16px;
    color: #fff;
    background: #15171c;
    border: 0;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 800;
}

.form-error,
.form-success {
    padding: 11px 12px;
    border-radius: 8px;
    font-weight: 700;
}

.form-error {
    color: #8b0e25;
    background: #ffe8ee;
}

.form-success {
    color: #075d47;
    background: #e4fff5;
}

.subtle-link {
    color: var(--muted);
    font-size: 14px;
    font-weight: 700;
    text-align: center;
}

@media (max-width: 860px) {
    .app-shell {
        padding-inline: clamp(10px, 3vw, 20px);
    }

    .swipe-stage {
        width: 100%;
        grid-template-columns: minmax(0, 1fr);
        gap: 3px;
    }

    .deck {
        min-height: 460px;
        min-height: clamp(460px, calc(100dvh - 166px), 640px);
    }

    .image-wrap {
        height: 520px;
        height: clamp(320px, 54dvh, 520px);
        min-height: 320px;
        min-height: clamp(320px, 54dvh, 520px);
    }

    .next-preview {
        width: 82px;
        height: 142px;
    }

    .next-preview::after {
        right: 4px;
        top: 50%;
        width: 34px;
        height: 34px;
        font-size: 29px;
    }

    .preview-card {
        width: 112px;
    }

    .preview-card + .preview-card {
        margin-top: -48px;
    }

    .action-rail {
        margin-top: -10px;
    }
}

@media (max-width: 680px) {
    .topbar {
        gap: 12px;
        min-height: 58px;
        padding: 6px 12px;
    }

    .brand span:last-child {
        display: inline;
        max-width: 128px;
        overflow: hidden;
        font-size: 18px;
        line-height: 1;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .topbar-actions {
        gap: 6px;
    }

    .brand {
        gap: 7px;
    }

    .brand-mark {
        flex-basis: 42px;
        width: 42px;
        height: 42px;
    }

    .icon-button,
    .theme-toggle {
        width: 34px;
        height: 34px;
        min-height: 34px;
    }

    .icon-button svg,
    .theme-toggle-icon {
        width: 16px;
        height: 16px;
    }

    .top-search-form {
        position: fixed;
        top: 66px;
        right: 12px;
        left: 12px;
        width: auto;
    }

    .public-menu {
        position: fixed;
        top: 66px;
        right: 12px;
        min-width: min(220px, calc(100vw - 24px));
    }

    .topnav {
        flex: 1;
        justify-content: flex-end;
    }

    .topnav a {
        padding: 7px 9px;
        font-size: 13px;
    }

    .app-shell {
        padding: 14px 12px 20px;
    }

    .feed-view {
        min-height: calc(100vh - 76px);
        min-height: calc(100dvh - 76px);
        align-items: start;
    }

    .swipe-stage {
        width: 100%;
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: auto auto auto;
        gap: 9px;
    }

    .deck {
        grid-column: 1;
        grid-row: 1;
        min-height: auto;
    }

    .meme-card {
        width: min(100%, 390px);
    }

    .meme-list-item {
        grid-template-columns: 104px minmax(0, 1fr);
        gap: 10px;
    }

    .meme-list-media {
        min-height: 104px;
    }

    .meme-list-body {
        gap: 6px;
        padding: 9px 9px 9px 0;
    }

    .meme-list-description {
        display: -webkit-box;
        overflow: hidden;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
        font-size: 12px;
    }

    .image-wrap {
        height: min(390px, 52dvh);
        min-height: min(390px, 52dvh);
    }

    .meme-description {
        font-size: 12.5px;
        line-height: 1.34;
    }

    .action-rail {
        position: static;
        grid-column: 1;
        grid-row: 3;
        gap: 9px;
        align-self: center;
        margin-top: 0;
        padding-top: 0;
    }

    .meme-meta .action-rail {
        grid-column: auto;
        grid-row: auto;
        justify-content: center;
        margin-top: 0;
        padding-top: 0;
    }

    .next-preview {
        display: flex;
        grid-column: 1;
        grid-row: 2;
        width: min(100%, 176px);
        height: 88px;
        align-items: center;
        justify-content: center;
        justify-self: center;
    }

    .meme-meta .next-preview,
    .next-preview.is-inline {
        width: min(100%, 176px);
        height: 88px;
        align-items: center;
        justify-content: center;
        justify-self: center;
        margin: 0;
    }

    .next-preview::after {
        right: 4px;
        top: 50%;
    }

    .meme-meta .next-preview::after,
    .next-preview.is-inline::after {
        right: 4px;
        left: auto;
        top: 50%;
    }

    .preview-card {
        flex: 0 0 auto;
        width: 104px;
    }

    .preview-card + .preview-card {
        margin-top: 0;
        margin-left: -54px;
    }

    .preview-card-1 {
        transform: rotate(-2deg) translateX(-2px);
    }

    .preview-card-2 {
        transform: rotate(3deg) scale(0.86);
    }

    .hand-action {
        width: 36px;
        height: 36px;
    }

    .thumb-icon {
        width: 22px;
        height: 22px;
    }

    .image-wrap::after {
        right: 1px;
        bottom: 1px;
        padding: 2px 1px 2px 5px;
        font-size: 11px;
    }

    .report-action,
    .share-action {
        height: 36px;
        width: 36px;
    }

    .action-icon {
        width: 22px;
        height: 22px;
    }

    .tutorial-panel {
        padding: 20px 16px 16px;
    }

    .tutorial-panel h2 {
        font-size: 22px;
    }

    .tutorial-actions {
        justify-content: stretch;
    }

    .tutorial-primary,
    .tutorial-secondary {
        flex: 1;
        padding: 0 10px;
    }
}

@media (max-width: 360px) {
    .topbar {
        padding-inline: 10px;
    }

    .brand span:last-child {
        max-width: 108px;
        font-size: 16px;
    }

    .topbar-actions {
        gap: 5px;
    }
}
