#addStory {
    --panel-font-family: var(--site-font-family);
    --add-story-green: #89C87F;
    --add-story-orange: #F19E47;
    --add-story-purple: #BA8EC8;
    --add-story-field: #E5E5E5;
}

.addStoryLauncher {
    position: fixed;
    z-index: 10;
    bottom: 15px;
    left: 15px;
    display: flex;
    align-items: center;
    gap: 16px;
    width: 221px;
    height: 56px;
    box-sizing: border-box;
    margin: 0;
    padding: 0 20px 0 19px;
    appearance: none;
    border: 1px solid #000;
    border-radius: 20px;
    background: #89C87F;
    color: #000;
    font-family: var(--site-font-family);
    font-size: 24px;
    font-weight: 400;
    line-height: normal;
    text-align: left;
    cursor: pointer;
    transition: filter 120ms ease, transform 60ms ease, background-color 120ms ease;
}

.addStoryLauncher:hover {
    filter: brightness(1.08);
}

.addStoryLauncher--active {
    background: rgba(99, 161, 158, 1);
}

.addStoryLauncher:active {
    filter: brightness(0.92);
    transform: translateY(1px);
}

.addStoryLauncher:focus-visible {
    outline: 2px solid #000;
    outline-offset: 2px;
}

.addStoryLauncherIcon {
    display: block;
    flex: 0 0 33px;
    width: 33px;
    height: 33px;
}

.addStoryLauncherLabel {
    flex: 0 0 auto;
    white-space: nowrap;
}

.addStoryContainer {
    position: fixed;
    z-index: 10000;
    top: 119px;
    right: 15px;
    bottom: auto;
    left: auto;
    width: min(760px, calc(100vw - 30px));
    height: auto;
    min-height: 0;
    max-height: calc(100dvh - 134px);
    box-sizing: border-box;
    overflow: hidden;
    transform: none;
    border: 1px solid #000;
    border-radius: 30px;
    background: var(--add-story-green);
    color: #000;
    font-family: var(--panel-font-family);
    font-size: 16px;
    font-weight: 400;
    letter-spacing: 0;
}

.addStoryContainer--pin-hidden,
.addStoryErrorMessage--pin-hidden {
    display: none;
}

.addStoryContainer--invalid {
    background: var(--add-story-orange);
}

.addStoryForm {
    position: relative;
    width: 100%;
    height: auto;
}

.addStoryHeader {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    height: 72px;
    box-sizing: border-box;
    padding: 0 23px 0 29px;
    border-bottom: 1px solid #000;
}

.addStoryTitle {
    font-weight: 500;
    line-height: normal;
}

.addStoryHeaderActions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.addStoryPublishButton,
.addStoryCloseButton,
.addStoryIconButton {
    display: grid;
    place-items: center;
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    color: #000;
    font: inherit;
    cursor: pointer;
}

.addStoryPublishButton {
    width: 93px;
    height: 32px;
    border: 1px solid #000;
    border-radius: 30px;
    background: var(--add-story-orange);
    font-weight: 500;
}

.addStoryPublishButton:disabled,
.addStoryCloseButton:disabled {
    cursor: wait;
    opacity: 0.7;
}

.addStoryContainer--invalid .addStoryPublishButton {
    background: var(--add-story-purple, #BA8EC8);
}

.addStoryCloseButton {
    position: relative;
    width: 33px;
    height: 33px;
    overflow: hidden;
    border: 1px solid #000;
    border-radius: 50%;
    background: var(--add-story-orange);
    box-shadow: none;
    font-size: 0;
    transition: filter 120ms ease, transform 60ms ease;
}

.addStoryCloseButton::before,
.addStoryCloseButton::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 18px;
    height: 2px;
    background: #000;
    transform-origin: center;
}

.addStoryCloseButton::before {
    transform: translate(-50%, -50%) rotate(45deg);
}

.addStoryCloseButton::after {
    transform: translate(-50%, -50%) rotate(-45deg);
}

.addStoryPublishButton:hover,
.addStoryCloseButton:hover,
.addStoryIconButton:hover {
    filter: brightness(1.06);
}

.addStoryPublishButton:active,
.addStoryCloseButton:active,
.addStoryIconButton:active {
    filter: brightness(0.94);
}

.addStoryCloseButton:active {
    transform: translateY(1px);
}

.addStoryPublishButton:focus-visible,
.addStoryIconButton:focus-visible {
    outline: 2px solid #000;
    outline-offset: 2px;
}

.addStoryCloseButton:focus-visible {
    outline: 3px solid #000;
    outline-offset: 2px;
}

.addStoryBody {
    box-sizing: border-box;
    max-height: max(0px, calc(100dvh - 208px));
    padding: 24px 21px 30px 22px;
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-width: none;
}

.addStoryBody::-webkit-scrollbar {
    display: none;
}

.addStoryScrollbar {
    position: absolute;
    z-index: 2;
    top: 349px;
    right: 0;
    width: 11px;
    height: 135px;
    box-sizing: border-box;
    border: 1px solid #000;
    border-radius: 30px;
    background: var(--add-story-orange);
    pointer-events: none;
    transition: opacity 120ms linear, background-color 120ms linear;
}

.addStoryScrollbar--hidden {
    opacity: 0;
}

.addStoryContainer--invalid .addStoryScrollbar {
    background: var(--add-story-green);
}

.addStoryFields {
    display: flex;
    flex-direction: column;
    gap: 21px;
}

.addStoryTopFields {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.addStoryPrimaryFields {
    display: grid;
    grid-template-columns: minmax(0, 1.8fr) minmax(0, 1fr);
    gap: 9px;
}

.addStoryLocationFields {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.addStoryExtraLocations:empty { display: none; }
.addStoryExtraLocations { display: flex; flex-direction: column; gap: 18px; }
.addStoryExtraLocationHeader { display: flex; align-items: center; justify-content: space-between; }
.addStoryExtraLocationHeader strong { font-size: 14px; font-weight: 400; line-height: 20px; text-decoration: none; }
.addStoryExtraLocationHeader button,
.addStoryAddLocation { border: 0; padding: 5px 2px; background: transparent; color: #231826; font: inherit; text-decoration: underline; cursor: pointer; }
.addStoryAddLocation { align-self: flex-start; margin: 0 0 7px 20px; padding: 0; color: inherit; font-size: 14px; font-weight: 400; line-height: 20px; text-underline-offset: 3px; }
.addStoryAddLocation::before { content: "+ "; text-decoration: none; }
.addStoryExtraLocationHeader button:focus-visible,
.addStoryAddLocation:focus-visible { outline: 2px solid #000; outline-offset: 3px; }

.addStoryLocationSearchRow {
    display: grid;
    grid-template-columns: minmax(0, 1.8fr) minmax(0, 1fr);
    column-gap: 9px;
    /* The action icons make this row taller; keep the visible field gaps even. */
    row-gap: 15px;
    align-items: center;
    min-height: 68px;
    margin-bottom: 0;
}

.addStoryInputDiv--localizing {
    grid-column: 1;
    grid-row: 1;
}

.addStoryLocationActions {
    z-index: 1;
    grid-column: 1;
    grid-row: 1;
    justify-self: end;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    transform: translateX(50%);
}

.addStoryLocationMessage {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
    min-height: 36px;
    box-sizing: border-box;
    padding-left: 24px;
    align-self: center;
    visibility: hidden;
    opacity: 0;
    color: #5B315F;
    font-size: 14px;
    font-weight: 500;
    line-height: 18px;
    transition: opacity 120ms linear;
}

.addStoryLocationMessage--visible {
    visibility: visible;
    opacity: 1;
}

.addStoryCustomPlace {
    grid-column: 1;
    grid-row: 2;
    margin: 0 0 0 20px;
}

.addStoryCustomPlace > summary {
    width: fit-content;
    max-width: 100%;
    overflow: hidden;
    list-style: none;
    font-size: 14px;
    line-height: 20px;
    text-overflow: ellipsis;
    text-decoration: underline;
    text-underline-offset: 3px;
    white-space: nowrap;
    cursor: pointer;
}

.addStoryCustomPlace > summary::-webkit-details-marker {
    display: none;
}

.addStoryCustomPlace > summary::before {
    content: "+ ";
    text-decoration: none;
}

.addStoryCustomPlace[open] > summary::before {
    content: "− ";
}

.addStoryCustomPlace > summary:focus-visible {
    outline: 2px solid #000;
    outline-offset: 3px;
}

.addStoryCustomPlaceContent {
    margin-top: 10px;
}

.addStoryInputDiv--customPlace {
    width: min(100%, 470px);
}

.addStoryLocationHint {
    margin: 7px 0 0 20px;
    color: #3f2a42;
    font-size: 13px;
    line-height: 18px;
}

.addStoryCoordinateRow {
    display: grid;
    grid-template-columns: minmax(0, 0.97fr) minmax(0, 1.03fr) 68px;
    gap: 11px;
    align-items: center;
}

.addStoryInputDiv--latitude {
    grid-column: 1;
}

.addStoryInputDiv--longitude {
    grid-column: 2;
}

.addStoryCoordinateActions {
    grid-column: 3;
    display: flex;
    align-items: center;
    gap: 4px;
}

.addStoryInputDiv {
    position: relative;
    display: flex;
    align-items: center;
    min-width: 0;
    height: 52px;
    box-sizing: border-box;
    padding: 0 14px;
    overflow: hidden;
    border: 1px solid #000;
    border-radius: 30px;
    background: var(--add-story-field);
}

.addStoryInputDiv--full {
    flex: 0 0 52px;
    width: 100%;
}

.addStoryInputDiv--multiline {
    flex-basis: auto;
    height: auto;
    min-height: 52px;
}

.addStoryFieldLabel {
    position: absolute;
    top: 50%;
    left: 14px;
    z-index: 1;
    max-width: calc(100% - 28px);
    transform: translateY(-50%);
    overflow-wrap: normal;
    color: #666;
    font: inherit;
    font-style: italic;
    line-height: 20px;
    cursor: text;
    transition: top 120ms ease, transform 120ms ease, font-size 120ms ease;
}

.addStoryInputDiv:focus-within > .addStoryFieldLabel,
.addStoryInputDiv--focused > .addStoryFieldLabel,
.addStoryInputDiv--filled > .addStoryFieldLabel {
    top: 7px;
    transform: none;
    font-size: 11px;
    line-height: 14px;
}

.addStoryInputDiv--multiline > .addStoryFieldLabel {
    top: 16px;
    transform: none;
}

.addStoryInputDiv--multiline:focus-within > .addStoryFieldLabel,
.addStoryInputDiv--multiline.addStoryInputDiv--filled > .addStoryFieldLabel { top: 7px; }

@media (prefers-reduced-motion: reduce) {
    .addStoryFieldLabel { transition: none; }
}

.addStoryInput,
.addStoryTextarea {
    flex: 1 1 auto;
    min-width: 0;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    margin: 0;
    padding: 15px 0 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: #000;
    font: inherit;
    letter-spacing: 0;
}

.addStoryInput::placeholder,
.addStoryTextarea::placeholder {
    color: #000;
    font-family: inherit;
    font-style: italic;
    opacity: 1;
}

.addStoryContainer .addStoryInput:-webkit-autofill,
.addStoryContainer .addStoryInput:-webkit-autofill:hover,
.addStoryContainer .addStoryInput:-webkit-autofill:focus,
.addStoryContainer .addStoryInput:-webkit-autofill:active {
    background-color: var(--add-story-field);
    -webkit-text-fill-color: #000;
    -webkit-box-shadow: 0 0 0 1000px var(--add-story-field) inset;
    box-shadow: 0 0 0 1000px var(--add-story-field) inset;
    caret-color: #000;
}

.addStoryContainer .addStoryInput:autofill {
    background-color: var(--add-story-field);
    box-shadow: 0 0 0 1000px var(--add-story-field) inset;
    color: #000;
    caret-color: #000;
}

.addStoryTextarea {
    min-height: 50px;
    padding: 24px 0 9px;
    overflow: hidden;
    resize: none;
    line-height: 20px;
}

.addStoryInputDiv:focus-within,
.addStoryInputDiv--focused {
    outline: 1px solid #000;
    outline-offset: -2px;
}

.addStoryContainer input[type="number"]::-webkit-outer-spin-button,
.addStoryContainer input[type="number"]::-webkit-inner-spin-button {
    margin: 0;
    -webkit-appearance: none;
}

.addStoryContainer input[type="number"] {
    appearance: textfield;
    -moz-appearance: textfield;
}

.addStoryIconButton {
    position: relative;
    width: 32px;
    height: 32px;
    border: 1px solid #000;
    border-radius: 20px;
    background: var(--add-story-orange);
}

.addStoryIconButton--locate,
.addStoryIconButton--pin {
    border: 0;
    background: transparent;
}

.addStoryIconButton--locate {
    width: 34px;
    height: 34px;
}

.addStoryIconButton--pin {
    width: 33px;
    height: 33px;
}

.addStoryIconButton img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.addStoryIconButton--check img {
    width: 18px;
    height: 12px;
}

.addStoryIconButton--clear span {
    transform: translateY(-1px);
    font-size: 24px;
    line-height: 30px;
}

.addStoryHashtags {
    flex-basis: auto;
    align-items: flex-start;
    min-height: 52px;
    height: auto;
    padding: 0 14px 0 20px;
    overflow: visible;
}

.addStoryHashtags > .addStoryFieldLabel {
    left: 20px;
}

.addStoryHashtags > .tagify {
    --tags-border-color: transparent;
    --tags-hover-border-color: transparent;
    --tags-focus-border-color: transparent;
    --placeholder-color: #000;
    --placeholder-color-focus: #000;
    --tag-bg: #BFBFBF;
    --tag-hover: #B3B3B3;
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
    min-height: 48px;
    padding-left: 50px;
    border: 0 !important;
    background: transparent;
    font-family: inherit;
}

.addStoryHashtags > .chipsInput { padding: 0 0 0 55px; }

.addStoryHashtags .tagify__input {
    margin: 0;
    padding: 16px 2px 10px;
    font-family: inherit;
    line-height: 20px;
}

.addStoryHashtags .tagify__input::before {
    font-family: inherit;
    font-style: italic;
    opacity: 1;
}

.addStoryHashtags .tagify__tag {
    margin-top: 10px;
    margin-bottom: 4px;
    border-radius: 999px !important;
}

.addStoryHashtags .tagify__tag > div,
.addStoryHashtags .tagify__tag > div::before {
    border-radius: 999px !important;
}

.addStoryErrorMessage {
    position: fixed;
    z-index: 10002;
    top: 50.8vh;
    left: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    width: min(1009px, calc(100vw - 48px));
    height: 101px;
    box-sizing: border-box;
    padding: 0 24px;
    transform: translateX(-50%);
    border: 1px solid #000;
    border-radius: 35px;
    background: var(--add-story-purple);
    color: #000;
    font-family: var(--panel-font-family);
    font-size: 24px;
    line-height: normal;
    text-align: center;
    pointer-events: none;
}

.addStoryErrorMessage--visible {
    display: flex;
}

.addStoryErrorMessage--confirmation {
    display: flex;
}

.addStoryErrorMessage--published {
    background: var(--add-story-green);
}

.addStoryErrorMessage--pending {
    background: var(--add-story-orange);
}

.addStoryConfirmationOverlay {
    position: fixed;
    z-index: 10001;
    inset: 0;
    background: transparent;
    cursor: pointer;
}

#buttonsOnScreen .addStoryLauncher.addStoryLauncher--invalid {
    background: var(--add-story-purple, #BA8EC8);
    filter: none;
    transform: none;
}

#buttonsOnScreen .addStoryLauncher.addStoryLauncher--invalid:hover {
    filter: brightness(1.08);
}

#buttonsOnScreen .addStoryLauncher.addStoryLauncher--invalid:active {
    filter: brightness(0.92);
    transform: translateY(1px);
}

.addStoryPinCursor {
    position: fixed;
    z-index: 10003;
    width: 30px;
    height: 36px;
    transform: translate(-15px, -35px);
    pointer-events: none;
}

.addStoryPinPlacementActive #map {
    cursor: none;
}

/* Pins only preview stories while the form is open; override their inline pointer cursor. */
.addStoryFormOpen #map .eventPoint {
    cursor: default !important;
}

.addStoryPinPlacementActive #map .eventPoint {
    cursor: none !important;
}

@media (max-width: 860px) {
    .addStoryPrimaryFields {
        grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
        gap: 10px;
    }

    .addStoryLocationSearchRow {
        grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
        column-gap: 10px;
        row-gap: 15px;
    }

    .addStoryCoordinateRow {
        grid-template-columns: minmax(0, 0.97fr) minmax(0, 1.03fr) 68px;
        gap: 10px;
    }
}

@media (max-width: 800px) {
    .addStoryLauncher--active {
        display: none;
    }

    .addStoryContainer {
        top: 119px;
        right: 15px;
        bottom: 15px;
        left: 15px;
        width: auto;
        height: auto;
        min-width: 0;
        max-height: calc(100dvh - 134px);
        transform: none;
    }

    .addStoryPrimaryFields {
        grid-template-columns: 1fr;
    }

    .addStoryLocationSearchRow {
        grid-template-columns: minmax(0, 1fr) 34px;
    }

    .addStoryLocationActions {
        grid-column: 2;
        justify-self: stretch;
        transform: none;
    }

    .addStoryLocationMessage {
        grid-column: 1 / -1;
        grid-row: 3;
        min-height: 36px;
        padding-left: 21px;
    }

    .addStoryCustomPlace {
        grid-column: 1 / -1;
    }

    .addStoryCoordinateRow {
        grid-template-columns: 1fr;
    }

    .addStoryInputDiv--latitude,
    .addStoryInputDiv--longitude,
    .addStoryCoordinateActions {
        grid-column: 1 / -1;
    }

    .addStoryCoordinateActions {
        justify-self: end;
    }

    .addStoryErrorMessage {
        width: calc(100vw - 24px);
        font-size: 20px;
    }
}

@media (max-width: 700px) {
    .addStoryContainer {
        z-index: 10002;
        top: 87px;
        bottom: 15px;
        max-height: calc(100dvh - 102px);
    }

    .addStoryBody {
        max-height: max(0px, calc(100dvh - 174px));
    }
}
