.writing-community-v3 {
    --community-gutter: clamp(16px,3vw,30px);
    --community-ink: #212127;
    --community-muted: #686875;
    --community-line: #ece8e6;
    --community-surface: #faf8f7;
    max-width: 965px;
    color: var(--community-ink);
    padding: 0 var(--community-gutter) 88px;
}
.community-topbar {
    position: sticky;
    top: 0;
    z-index: 8;
    display: grid;
    grid-template-columns: 84px minmax(0, 1fr) 84px;
    align-items: center;
    min-height: 60px;
    background: #fff;
    text-align: center;
}
.community-topbar h1 { font-size: 19px; font-weight: 750; line-height: 1.2; }
.community-back {
    display: inline-grid;
    place-items: center;
    justify-self: start;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: #f6f5f4;
    color: #25252c;
    font-size: 27px;
    text-decoration: none;
    cursor: pointer;
}
.community-back > svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.community-back:focus-visible { outline: 2px solid var(--primary-color); outline-offset: 2px; }
.community-top-action {
    justify-self: end;
    padding: 8px 10px;
    border: 0;
    border-radius: 18px;
    background: var(--writing-accent-soft);
    color: var(--writing-accent-text);
    font: inherit;
    font-size: 12px;
    font-weight: 750;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
}
.community-notice {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 10px 0 12px;
    padding: 11px 12px;
    border: 1px solid #ffe0d3;
    border-radius: 12px;
    background: #fff7f3;
    color: #9b4429;
    font-size: 13px;
}
.community-notice button { flex: none; padding: 6px 10px; }
.community-blank {
    display: grid;
    place-items: center;
    align-content: center;
    gap: 8px;
    padding: 44px 20px 38px;
    color: var(--community-ink);
    text-align: center;
}
.community-blank > span { display: grid; place-items: center; width: 48px; height: 48px; margin-bottom: 6px; border-radius: 16px; background: var(--writing-accent-soft); color: var(--writing-accent-text); font-size: 24px; }
.community-blank h2 { font-size: 17px; font-weight: 750; line-height: 1.35; }
.community-blank p { max-width: 26ch; color: var(--community-muted); font-size: 13px; line-height: 1.6; }
.community-state-icon svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
.community-detail-heading { margin: 18px 0 12px !important; font-size: clamp(22px,4vw,32px); overflow-wrap: anywhere; }
.community-fab {
    position: fixed;
    z-index: 22;
    right: max(18px, calc(12px + env(safe-area-inset-right)));
    bottom: calc(20px + env(safe-area-inset-bottom));
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--primary-color);
    box-shadow: 0 5px 15px #d84a313b;
    color: #fff;
    cursor: pointer;
}
.community-fab svg, .community-reel-toolbar svg, .community-gift-open svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
.community-fab:focus-visible, .community-reel :focus-visible, .community-drawer :focus-visible { outline: 2px solid var(--primary-light); outline-offset: 3px; }
.community-more { display: block; margin: 14px auto; }

.writing-reel-page { position: relative; display: flex; flex-direction: column; height: 100vh; height: 100dvh; padding-bottom: max(12px,env(safe-area-inset-bottom)); }
.writing-reel-page .community-topbar { flex: none; }
.community-reel {
    position: relative;
    flex: 1;
    min-height: 0;
    width: min(100%, 560px);
    margin-inline: auto;
    overflow: auto;
    overscroll-behavior-y: contain;
    scroll-snap-type: y mandatory;
    scrollbar-width: none;
    border-radius: 19px;
    background: #2e2526;
}
.community-reel::-webkit-scrollbar { display: none; }
.community-reel-card {
    --paper-color: #3a2928;
    --paper-accent: #c28064;
    --paper-wash: #fff3ec;
    box-sizing: border-box;
    position: relative;
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
    align-items: stretch;
    gap: 15px;
    min-height: 100%;
    height: 100%;
    padding: clamp(14px,4vw,30px);
    overflow: hidden;
    background: var(--paper-color);
    background: radial-gradient(at 35% 0%,color-mix(in srgb, var(--paper-accent) 34%,transparent),transparent 57%), var(--paper-color);
    color: #fff;
    scroll-snap-align: start;
    scroll-snap-stop: always;
}
.community-reel-card.paper-1 { --paper-color: #28303f; --paper-accent: #83a4ca; --paper-wash: #edf6ff; }
.community-reel-card.paper-2 { --paper-color: #3b272d; --paper-accent: #dd9c8d; --paper-wash: #fff0e9; }
.community-paper {
    position: relative;
    isolation: isolate;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: clamp(9px,2vh,20px);
    padding: clamp(18px,5vw,36px);
    margin-right: 48px;
    border-radius: 14px;
    background: linear-gradient(140deg, #fff 12%, var(--paper-wash));
    box-shadow: 0 8px 20px #16101837;
    color: var(--paper-color);
}
.community-paper-quote { position: absolute; z-index: -1; top: clamp(10px,6vh,48px); left: 18px; opacity: .2; color: var(--paper-accent); font: 700 clamp(120px,22vh,240px)/1 Georgia,serif; }
.community-paper-author { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 650; }
.community-paper h2 { font-family: 'STSong','Songti SC','Noto Serif SC',serif; font-size: clamp(22px,5.4vw,41px); line-height: 1.35; letter-spacing: .025em; overflow-wrap: anywhere; }
.community-paper h2.long-title { font-size: clamp(17px,4.65vw,28px); }
.community-original { display: inline-flex; align-items: center; gap: 7px; border: 0; border-radius: 20px; background: var(--paper-color); color: #fff; padding: 8px 12px; font: inherit; font-size: 12px; font-weight: 750; cursor: pointer; }
.community-reel-toolbar { position: absolute; right: clamp(11px,3vw,20px); bottom: clamp(105px,15vh,140px); display: grid; justify-items: center; gap: 6px; width: 43px; }
.community-reel-toolbar button { display: grid; justify-items: center; gap: 3px; min-width: 42px; padding: 6px 2px; border: 0; background: transparent; color: #fff; font: inherit; font-size: 10px; cursor: pointer; }
.community-reel-toolbar button[aria-pressed=true] { color: #ffd283; }
.community-reel-votes { align-self: end; display: grid; gap: 8px; }
.community-reel-votes > div { display: grid; grid-template-columns: 1fr 1fr 42px; gap: 7px; }
.community-reel-votes button { display: grid; place-items: center; min-height: 42px; border: 1px solid transparent; border-radius: 10px; color: #fff; font: inherit; font-size: 13px; font-weight: 750; cursor: pointer; }
.community-reel-votes .side-positive { background: var(--primary-color); }
.community-reel-votes .side-negative { background: #625599; }
.community-reel-votes .community-gift-open { background: #fff2; }
.community-reel-votes button[aria-pressed=true] { border-color: #fff; box-shadow: 0 0 0 2px #fff6; }
.community-reel-score { display: flex; justify-content: space-between; min-height: 14px; padding-bottom: 5px; border-radius: 5px; background: linear-gradient(90deg,#ff926c var(--support),#b8a6f9 var(--support)) left bottom / 100% 3px no-repeat; font-size: 10px; font-variant-numeric: tabular-nums; }
.community-reel-nav { position: absolute; top: 48%; right: max(20px,calc((100% - 650px)/2)); display: grid; gap: 7px; }
.community-reel-nav button { display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid #eee9ef; border-radius: 50%; background: #fff; color: #62576e; font-size: 24px; cursor: pointer; }
.community-reel-nav button:disabled { opacity: .35; cursor: default; }
.community-reel-toast { position: absolute; z-index: 12; inset: 67px 30px auto; width: max-content; max-width: calc(100% - 60px); margin-inline: auto !important; padding: 9px 14px; border-radius: 12px; background: #231e2fe9; color: #fff; font-size: 12px; pointer-events: none; }
.reel-blank { padding-block: clamp(52px,14vh,135px) 40px; }

.community-drawer-backdrop { position: fixed; z-index: 9999; inset: 0; display: grid; align-items: end; justify-items: center; background: #1c172a85; }
.community-drawer {
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    width: min(100%,570px);
    max-height: min(82vh,780px);
    max-height: min(82dvh,780px);
    overflow: auto;
    overscroll-behavior: contain;
    border-radius: 22px 22px 0 0;
    padding: 0 17px max(20px,env(safe-area-inset-bottom));
    background: #fff;
    color: #24212a;
    box-shadow: 0 -8px 46px #21172b3f;
    --ink: #24212a;
    --line: #ece9f1;
    --muted: #6e6c78;
}
.community-drawer > header { position: sticky; top: 0; z-index: 1; display: flex; flex: none; justify-content: space-between; align-items: center; gap: 10px; min-height: 56px; border-bottom: 1px solid #efedf2; background: #fff; }
.community-drawer > header h2 { margin: 0; font-size: 18px; }
.community-drawer-close { width: 34px; height: 34px; border: none; border-radius: 50%; background: #f5f3f8; color: #494453; font-size: 22px; cursor: pointer; }
.community-drawer-message { margin: 9px 0; padding: 9px 10px; border-radius: 8px; background: #fff3ec; color: #985235; font-size: 13px; }
.community-original-drawer { height: min(92dvh,860px); max-height: 92dvh; }
.community-reading-controls { display: flex; flex: none; justify-content: flex-end; gap: 5px; padding-block: 8px; }
.community-reading-controls .writing-button { font-size: 12px; padding: 6px 9px; }
.community-paper-reader { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; scrollbar-gutter: stable; border-radius: 12px; padding: 16px 18px; background: #f9f5ec; color: #362d26; line-height: 1.9; overflow-wrap: anywhere; }
.community-paper-reader.night { background: #211f28; color: #f7ece4; }
.community-paper-reader h3 { margin: 0 0 16px; font-size: 1.32em; }
.community-paper-reader p { margin: 0; white-space: pre-wrap; }
.community-paper-reader aside { margin-top: 28px; border-top: 1px solid #a296852e; }
.community-gift-group h3 { color: #504462; font-size: 15px; }
.community-gift-confirm { padding-block: 10px; }
.community-gift-confirm button { margin-inline-end: 5px; }
.community-drawer-form label { display: grid; gap: 7px; color: #544a60; }
.community-drawer-form textarea { resize: vertical; }
.community-drawer-form > button { justify-self: start; }
body:has(.community-drawer-backdrop) { overflow: hidden !important; }

.community-help-hero { position: relative; isolation: isolate; overflow: hidden; min-height: clamp(148px,24vw,234px); display: grid; align-items: center; margin: 5px 0 22px; padding: clamp(21px,4.4vw,44px); border-radius: 18px; background: #fbede3 url('/images/writing-v2/desk.jpg') center right / cover no-repeat; color: #34221d; }
.community-help-hero::before { position: absolute; z-index: -1; inset: 0; content: ''; background: linear-gradient(90deg,#fff6ed 0%,#fff2e9ee 30%,#fff2e982 60%,transparent 94%); }
.community-help-hero h2 { font-size: clamp(24px,5.2vw,42px); line-height: 1.19; font-weight: 780; letter-spacing: -.02em; }
.community-help-hero p { margin-top: 10px; font-size: clamp(12px,2vw,15px); line-height: 1.45; }
.community-list-heading { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 0 0 11px; }
.community-list-heading h2 { font-size: 18px; font-weight: 750; line-height: 1.3; }
.community-help-answers svg { flex: none; width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
.community-help-filters { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 13px; scrollbar-width: none; }
.community-help-filters button { flex: none; min-height: 35px; padding: 0 12px; border: 0; border-radius: 18px; background: var(--community-surface); color: var(--community-muted); font: inherit; font-size: 12px; cursor: pointer; }
.community-help-filters button[aria-pressed=true] { background: var(--writing-accent-soft); color: var(--writing-accent-text); font-weight: 730; }
.community-help-list { border-top: 1px solid var(--community-line); }
.community-help-card { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 17px 3px; border-bottom: 1px solid var(--community-line); color: inherit; text-decoration: none; }
.community-help-card-copy { display: grid; flex: 1; gap: 7px; min-width: 0; }
.community-help-thumb { flex: none; width: clamp(70px, 23vw, 110px); aspect-ratio: 4 / 3; border-radius: 8px; object-fit: cover; }
.community-help-card h3 { font-size: 17px; font-weight: 740; line-height: 1.4; overflow-wrap: anywhere; }
.community-help-card p { display: -webkit-box; overflow: hidden; -webkit-line-clamp: 2; -webkit-box-orient: vertical; color: var(--community-muted); font-size: 13px; line-height: 1.55; overflow-wrap: anywhere; }
.community-help-card-meta { display: flex; align-items: center; gap: 6px; min-width: 0; color: var(--community-muted); font-size: 11px; }
.community-help-card-meta img { flex: none; width: 17px; height: 17px; border-radius: 50%; object-fit: cover; }
.community-help-card-meta img[hidden] { display: none; }
.community-help-author { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.community-help-answers { display: inline-flex; align-items: center; gap: 4px; color: var(--community-muted); white-space: nowrap; }
.community-help-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.community-help-tags span { border-radius: 12px; padding: 4px 8px; background: var(--community-surface); color: var(--community-muted); font-size: 11px; font-weight: 650; }
.community-help-state[data-state=open] { background: #fff0e9; color: #a73c20; }
.community-help-state[data-state=paid] { background: #ecf6ef; color: #356149; }
.community-help-tags .has-bounty { background: #fff2df; color: #8d4d18; }
.community-help-arrow { flex: none; color: var(--primary-color); font-size: 22px; line-height: 1; }
.writing-kind-help .writing-document, .writing-kind-discussion .writing-document { max-width: none; padding: 0; margin-block: 15px 20px; background: transparent; font-size: 15px; line-height: 1.8; }
.writing-kind-help .writing-help-status { border-color: var(--community-line); background: #fff8f2; }
.writing-community-v3 .writing-replies { border-color: var(--community-line); }
.writing-community-v3 .writing-feedback textarea { border-color: var(--community-line); background: #fff; }

.front-layout-media {
    position: relative;
    display: grid;
    flex: 0 0 min(29%,144px);
    grid-template-columns: minmax(0,1fr);
    gap: 2px;
    min-width: 68px;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    border-radius: 11px;
    background: #f4f1ef;
}
.front-layout-media.has-pair { grid-template-columns: repeat(2,minmax(0,1fr)); }
.front-layout-media img, .community-paper-media img { display: block; width: 100%; height: 100%; min-height: 0; object-fit: cover; }
.front-layout-media img[hidden], .community-paper-media img[hidden], .community-entry-thumb[hidden], .community-post-image[hidden] { display: none; }
.front-layout-media > span, .community-paper-image-count {
    position: absolute;
    top: 6px;
    right: 6px;
    padding: 3px 6px;
    border-radius: 10px;
    background: #211c1bc7;
    color: #fff;
    font-size: 10px;
    line-height: 1.15;
}
.writing-entry-card > .community-entry-thumb { flex: 0 0 auto; width: min(27%,102px); aspect-ratio: 4 / 3; object-fit: cover; }
.writing-entry-card > .community-entry-thumb:not([hidden]) + .writing-entry-arrow { padding-inline: 0; }

.community-paper-illustrated { gap: clamp(8px,1.6vh,16px); padding: clamp(13px,4.2vw,25px); }
.community-paper-illustrated h2 { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 4; overflow: hidden; }
.community-paper-illustrated .community-original { flex: none; }
.community-paper-media {
    position: relative;
    display: grid;
    flex: 0 1 auto;
    grid-template-columns: minmax(0,1fr);
    gap: 4px;
    width: 100%;
    min-height: 0;
    height: clamp(66px,23vh,214px);
    overflow: hidden;
    border-radius: 11px;
    background: var(--paper-wash);
}
.community-paper-media.media-count-2 { grid-template-columns: repeat(2,minmax(0,1fr)); }
.community-paper-media.media-count-3 { grid-template-columns: repeat(3,minmax(0,1fr)); }
.community-paper-gallery .community-paper-media { order: -1; }
.community-paper-cover { overflow: hidden; justify-content: flex-end; background: var(--paper-color); color: #fff; }
.community-paper-cover .community-paper-media { position: absolute; z-index: -2; inset: 0; height: auto; border-radius: 0; background: var(--paper-color); }
.community-paper-cover::before { content: ""; position: absolute; z-index: -1; inset: 0; background: linear-gradient(180deg,transparent 26%,#2018195c 55%,#201819 100%); }
.community-paper-cover .community-original { background: #fff; color: #342825; }

.community-post-gallery { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); grid-auto-rows: auto; gap: 8px; margin-block: 12px 18px; }
.community-post-gallery.has-one { grid-template-columns: minmax(0,1fr); }
.community-post-image { position: relative; display: block; min-width: 0; overflow: hidden; border-radius: 12px; background: #f6f3f1; }
.community-post-image img { display: block; width: 100%; aspect-ratio: 4 / 3; max-height: 430px; object-fit: contain; }
.community-post-image:focus-visible { outline: 2px solid var(--primary-color); outline-offset: 2px; }
.community-post-gallery.has-one .community-post-image img { aspect-ratio: auto; }
.post-gallery-cover .community-post-image:first-child { grid-column: 1 / -1; }
.post-gallery-cover .community-post-image:first-child img { aspect-ratio: 16 / 9; object-fit: cover; }
.post-gallery-gallery:not(.has-one) {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: min(81%,340px);
    overflow-x: auto;
    padding: 2px 2px 7px;
    overscroll-behavior-inline: contain;
    scroll-snap-type: x mandatory;
    scrollbar-width: thin;
}
.post-gallery-gallery .community-post-image { scroll-snap-align: start; }
.community-paper-reader.night .community-post-image, .writing-document.night .community-post-image { background: #2d2931; }

@media(min-width: 1024px) {
    .community-fab { right: max(26px, calc((100vw - 905px) / 2)); }
}
@media(max-width: 760px) {
    .writing-community-v3 { --community-gutter: 16px; }
    .community-topbar { min-height: 51px; }
    .community-topbar h1 { font-size: 17px; }
    .community-back { width: 35px; height: 35px; }
    .community-reel { border-radius: 16px; }
    .community-reel-nav { display: none; }
    .writing-reel-page .reel-submit { width: 45px; height: 45px; }
    .community-reel-votes { padding-right: 53px; }
    .community-reel-toolbar { bottom: clamp(100px,16vh,155px); }
    .community-help-hero { border-radius: 15px; }
}
@media(max-height: 590px) {
    .community-paper { padding-block: 12px; }
    .community-paper h2 { font-size: clamp(16px,4.2vw,27px); }
    .community-paper h2.long-title { font-size: clamp(13px,3.8vw,19px); }
    .community-reel-toolbar { bottom: 116px; gap: 2px; }
    .community-reel-toolbar button { padding-block: 2px; }
}
