.story-submitted {
    max-width: 580px;
    margin: 8px auto 24px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 28px;
    background: var(--card);
    box-shadow: var(--shadow);
    text-align: center;
}
.submission-main {
    padding: clamp(28px, 6vw, 48px) clamp(20px, 5vw, 44px) 28px;
    background: radial-gradient(ellipse at 50% 0, rgba(20, 184, 166, .13), transparent 70%);
}
.submission-mark {
    display: grid;
    place-items: center;
    width: 80px;
    height: 80px;
    margin: 8px auto 30px;
    border: 6px solid var(--card);
    border-radius: 50%;
    background: var(--brand);
    color: #fff;
    box-shadow: 0 0 0 1px rgba(20, 184, 166, .25), 0 0 0 12px rgba(20, 184, 166, .08);
    font-size: 1.9rem;
}
.submission-eyebrow { margin: 0 0 10px; color: var(--brand); font-size: .78rem; font-weight: 800; letter-spacing: .06em; }
.story-submitted h1 { margin: 0 auto 14px; max-width: 420px; color: var(--ink); font-size: clamp(1.65rem, 5vw, 2.3rem); font-weight: 800; line-height: 1.2; letter-spacing: -.04em; text-wrap: balance; }
.submission-description { max-width: 360px; margin: 0 auto 28px; color: var(--muted); font-size: .94rem; line-height: 1.8; }
.submission-status {
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 370px;
    margin: 0 auto;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--bg);
    text-align: left;
}
.submission-status-icon { display: grid; place-items: center; flex: 0 0 40px; height: 40px; border-radius: 12px; background: var(--card); color: var(--brand); font-size: 1.2rem; }
.submission-status strong { display: block; color: var(--ink); font-size: .85rem; }
.submission-status p { margin: 4px 0 0; color: var(--muted); font-size: .78rem; line-height: 1.6; }
.submission-actions { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 24px clamp(20px, 5vw, 44px) 28px; border-top: 1px solid var(--line); }
.submission-actions > p { margin: 0; color: var(--muted); font-size: .82rem; }
.submission-socials { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; width: 100%; max-width: 370px; }
.submission-social {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 9px;
    min-height: 88px; padding: 14px 6px; border: 1px solid rgba(255,255,255,.15); border-radius: 15px;
    color: #fff; font-size: .72rem; font-weight: 700; text-decoration: none;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.2), 0 4px 0 var(--social-depth), 0 12px 18px -14px rgba(0,0,0,.45);
    transition: transform .18s ease, box-shadow .18s ease;
}
.submission-social i { font-size: 1.5rem; }
.submission-instagram { --social-depth: #942050; background: linear-gradient(140deg, #833ab4, #c13584 55%, #d25738); }
.submission-tiktok { --social-depth: #080e13; background: linear-gradient(140deg, #263944, #111827); }
.submission-tiktok i { text-shadow: -1px -1px 0 #25f4ee, 1px 1px 0 #fe2c55; }
.submission-whatsapp { --social-depth: #075e49; background: linear-gradient(140deg, #148b62, #08794e); }
.submission-social:hover { color: #fff; transform: translateY(-2px); box-shadow: inset 0 1px 0 rgba(255,255,255,.2), 0 6px 0 var(--social-depth), 0 14px 20px -14px rgba(0,0,0,.45); }
.submission-social:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--social-depth); }
.submission-social:focus-visible { outline: 3px solid var(--brand-600); outline-offset: 5px; }
@media (prefers-reduced-motion: reduce) { .submission-social { transition: none; } .submission-social:hover { transform: none; } }
@media (max-width: 359.98px) { .submission-socials { grid-template-columns: 1fr; } .submission-social { flex-direction: row; min-height: 48px; } }
.submission-home { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; color: var(--muted); font-size: .8rem; font-weight: 600; text-decoration: none; }
.submission-home:hover { color: var(--brand); }
[data-theme="dark"] .submission-eyebrow,
[data-theme="dark"] .submission-status-icon { color: #5eead4; }

.story-composer {
    --compose-font-size: 26px;
    --compose-background-image: url('../images/story-background-orange.jpg');
    --compose-background-filter: none;
    border: 1px solid var(--line);
    border-radius: 16px;
    overflow: hidden;
}
.story-composer-tools {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--card);
    border-bottom: 1px solid var(--line);
}
.story-composer [hidden] { display: none !important; }
.story-composer [data-color="darkblue"], .story-composer [data-color="pink"] {
    --compose-background-image: url('../images/story-background-purple.jpg');
}
.story-composer [data-color="darkblue"] { --compose-background-filter: hue-rotate(-60deg) saturate(.8) brightness(.42); }
.story-composer [data-color="pink"] { --compose-background-filter: hue-rotate(50deg); }
.composer-colors { flex: 1 1 300px; display: flex; flex-wrap: wrap; gap: 8px; min-width: 0; margin: 0; padding: 0; border: 0; }
.composer-color { position: relative; display: flex; flex-direction: column; align-items: center; gap: 5px; min-width: 46px; margin: 0; font-size: .65rem; color: var(--muted); cursor: pointer; }
.composer-color input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.composer-color-swatch { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 10px; background: var(--compose-background-image) center / 100% 100%; filter: var(--compose-background-filter); color: #fff; }
.composer-color-swatch i { visibility: hidden; }
.composer-color input:checked + .composer-color-swatch { box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--ink); }
.composer-color input:checked + .composer-color-swatch i { visibility: visible; }
.composer-color input:focus-visible + .composer-color-swatch { outline: 3px solid var(--brand-600); outline-offset: 5px; }
.composer-photo-actions { display: flex; flex-wrap: nowrap; align-items: center; gap: 8px; flex-shrink: 0; }
.composer-photo-button, .composer-remove {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    margin: 0;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--card);
    color: var(--ink);
    font: inherit;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
}
.composer-photo-button input { position: absolute; inset: 0; width: 100%; opacity: 0; cursor: pointer; }
.composer-photo-button:focus-within, .composer-remove:focus-visible { outline: 3px solid var(--brand-600); outline-offset: 2px; }
.story-compose-surface { position: relative; isolation: isolate; background: #bd3600; }
.story-compose-surface::before {
    content: '';
    position: absolute;
    z-index: -2;
    inset: 0;
    background: var(--compose-background-image) center / 100% 100% no-repeat;
    filter: var(--compose-background-filter);
    pointer-events: none;
}
.story-compose-background {
    position: absolute;
    z-index: -1;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: grayscale(1) brightness(.85);
    pointer-events: none;
}
.story-compose-mirror,
.story-write-workspace .story-compose-surface textarea.story-textarea {
    box-sizing: border-box;
    width: 100%;
    min-height: 360px;
    margin: 0;
    padding: 28px 24px;
    border: 0;
    border-radius: 0;
    font-family: Arial, Helvetica, sans-serif;
    font-size: var(--compose-font-size);
    font-weight: 800;
    font-style: normal;
    font-variant: normal;
    line-height: 1.32;
    letter-spacing: 0;
    text-align: center;
    text-indent: 0;
    text-transform: none;
    white-space: pre-wrap;
    overflow-wrap: break-word;
    word-break: normal;
    tab-size: 4;
}
.story-compose-mirror { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; pointer-events: none; color: #080808; }
.story-compose-lines { flex: 0 0 auto; width: 100%; }
.story-compose-mirror span {
    background: #fff;
    padding: .07em 0;
    border-radius: 5px;
    box-shadow: 6px 0 0 #fff, -6px 0 0 #fff;
    -webkit-box-decoration-break: clone;
    box-decoration-break: clone;
}
.story-write-workspace .story-compose-surface textarea.story-textarea {
    display: block;
    position: relative;
    resize: vertical;
    background: #fff;
    color: #080808;
    box-shadow: none;
}
.story-write-workspace .is-enhanced .story-compose-surface textarea.story-textarea {
    resize: none;
    overflow: hidden;
    background: transparent;
    color: transparent;
    -webkit-text-fill-color: transparent;
    caret-color: #080808;
}
.story-write-workspace .is-enhanced .story-compose-surface textarea.story-textarea::placeholder {
    color: transparent;
    -webkit-text-fill-color: transparent;
    opacity: 0;
}
.story-compose-writing-indicator {
    display: none;
    position: absolute;
    top: calc(50% - 44px);
    left: 50%;
    transform: translate(-50%, -100%);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #fff;
    color: #080808;
    font-size: 1.15rem;
    pointer-events: none;
}
.is-enhanced .story-compose-writing-indicator { display: grid; place-items: center; }
.story-compose-writing-indicator i { animation: composer-writing-pulse 1.6s ease-in-out infinite; }
.story-compose-surface textarea:not(:placeholder-shown) + .story-compose-writing-indicator { display: none; }
@keyframes composer-writing-pulse {
    0%, 100% { opacity: 1; transform: rotate(-8deg); }
    50% { opacity: .55; transform: rotate(8deg); }
}
@media (prefers-reduced-motion: reduce) { .story-compose-writing-indicator i { animation: none; } }
.story-compose-surface:focus-within { outline: 3px solid var(--brand-600); outline-offset: -3px; }
.composer-help { margin: 10px 0 16px; font-size: .78rem; line-height: 1.6; color: var(--muted); }
@media (max-width: 575.98px) {
    .story-composer-tools { align-items: end; gap: 8px; padding: 10px 6px; }
    .composer-colors { flex: 1 1 132px; flex-wrap: nowrap; gap: 0; }
    .composer-color { min-width: 44px; min-height: 44px; justify-content: center; }
    .composer-color-swatch { width: 36px; height: 36px; }
    .composer-photo-actions { margin-left: auto; }
    .story-compose-mirror,
    .story-write-workspace .story-compose-surface textarea.story-textarea {
        min-height: 300px;
        padding: 24px 16px;
        font-size: calc(var(--compose-font-size) * .85);
    }
}
@media (forced-colors: active) {
    .story-compose-mirror { visibility: hidden; }
    .story-write-workspace .is-enhanced .story-compose-surface textarea.story-textarea {
        color: CanvasText;
        -webkit-text-fill-color: CanvasText;
        caret-color: CanvasText;
        background: Canvas;
    }
    .story-write-workspace .is-enhanced .story-compose-surface textarea.story-textarea::placeholder {
        color: GrayText;
        -webkit-text-fill-color: GrayText;
        opacity: 1;
    }
}
@media print {
    .story-composer-tools { display: none; }
    .story-compose-writing-indicator { display: none !important; }
}

/* Preserve the card feature while showing only a native writing field. */
.story-composer[data-appearance-enabled="false"] .story-composer-tools,
.story-composer[data-appearance-enabled="false"] .story-compose-surface::before { display: none !important; }
.story-composer[data-appearance-enabled="false"] .story-compose-surface { background: var(--card); }
.story-write-workspace .story-composer[data-appearance-enabled="false"] textarea.story-textarea {
    min-height: 360px;
    padding: 1rem;
    background: var(--card);
    color: var(--ink);
    font-family: 'Lora', Georgia, serif;
    font-size: 1.08rem;
    font-weight: 400;
    line-height: 1.8;
    text-align: left;
}
.story-composer[data-appearance-enabled="false"] textarea.story-textarea::placeholder { color: var(--muted); opacity: 1; }
.story-composer[data-appearance-enabled="false"]:focus-within {
    border-color: var(--brand-600);
    box-shadow: 0 0 0 3px rgba(13, 148, 136, .15);
}
.story-composer[data-appearance-enabled="false"] .story-compose-surface:focus-within { outline: none; }
@media (max-width: 575.98px) {
    .story-write-workspace .story-composer[data-appearance-enabled="false"] textarea.story-textarea { min-height: 52vh; font-size: 1.05rem; }
}

/* Raised surfaces stay flat where native text and its mirror must align. */
.write-studio {
    --studio-edge: #d4e5df;
    --studio-glint: rgba(255, 255, 255, .95);
    --studio-tint: #f3f9f6;
    --studio-depth: rgba(23, 64, 53, .09);
    position: relative;
    padding: 44px 0 72px;
    background: radial-gradient(ellipse at 8% 14%, rgba(94, 234, 212, .13), transparent 44%),
        radial-gradient(ellipse at 94% 45%, rgba(251, 191, 36, .1), transparent 42%);
}
.writing-intro { max-width: 740px; margin: 0 auto 32px; text-align: center; }
.writing-emblem {
    display: grid; place-items: center; width: 64px; height: 64px; margin: 0 auto 24px;
    border: 1px solid #292929; border-radius: 21px; overflow: hidden;
    background: #000; color: #fff; font-size: 1.65rem;
    box-shadow: inset 2px 2px 1px rgba(255,255,255,.4), inset -2px -2px 2px rgba(0,0,0,.12),
        0 5px 0 #202020, 0 14px 24px -8px rgba(0,0,0,.3);
}
.writing-emblem img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center; }
.writing-eyebrow { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 0 0 12px; color: var(--brand); font-size: .65rem; font-weight: 800; letter-spacing: .14em; }
.writing-eyebrow span { width: 6px; height: 6px; border-radius: 50%; background: #14b8a6; box-shadow: 0 0 0 4px rgba(20,184,166,.1); }
.write-studio .write-prompt { margin-bottom: 12px; font-size: clamp(1.4rem, 4.2vw, 2.5rem); letter-spacing: -.04em; }
.writing-lead { max-width: 490px; margin: 0 auto; color: var(--muted); font-size: .9rem; line-height: 1.8; }
.writing-panel {
    padding: clamp(18px, 3.5vw, 32px); border: 1px solid var(--studio-edge); border-radius: 28px;
    background: var(--card);
    box-shadow: inset 0 2px 0 var(--studio-glint), 0 6px 0 var(--studio-edge),
        0 7px 0 var(--studio-glint), 0 24px 48px -20px var(--studio-depth);
}
.writing-panel-heading { display: flex; align-items: center; gap: 13px; margin-bottom: 24px; }
.writing-panel-icon, .guidelines-heading-icon {
    display: grid; place-items: center; flex: 0 0 45px; height: 45px; border-radius: 15px;
    border: 1px solid var(--studio-edge); background: linear-gradient(145deg, var(--card), var(--studio-tint));
    color: var(--brand); box-shadow: inset 0 2px 0 var(--studio-glint), 0 3px 0 var(--studio-edge); font-size: 1.05rem;
}
.writing-panel-kicker { margin: 0 0 5px; color: var(--muted); font-size: .58rem; font-weight: 700; letter-spacing: .12em; }
.writing-panel-heading h2 { margin: 0; color: var(--ink); font-size: 1.15rem; font-weight: 800; letter-spacing: -.025em; }
.writing-panel-heading label { cursor: text; }
.writing-panel-note { margin-left: auto; color: var(--muted); font-size: .72rem; white-space: nowrap; }
.writing-panel-note i { margin-right: 5px; color: var(--brand); }
.write-studio .story-composer { border-color: var(--studio-edge); border-radius: 20px; box-shadow: 0 3px 0 var(--studio-depth), 0 12px 24px -16px rgba(139,63,13,.28); }
.write-studio .story-composer-tools { padding: 12px 16px; gap: 12px; background: linear-gradient(180deg, var(--card), var(--studio-tint)); }
.composer-toolbar-label { color: var(--muted); font-size: .72rem; font-weight: 600; }
.write-studio .composer-colors { flex-basis: auto; }
.write-studio .composer-color { flex-direction: row; gap: 9px; min-width: 0; min-height: 44px; padding: 4px 10px 4px 5px; border: 1px solid var(--studio-edge); border-radius: 12px; background: var(--card); }
.write-studio .composer-color-swatch { width: 28px; height: 28px; border-radius: 8px; }
.write-studio .composer-color input:checked + .composer-color-swatch { box-shadow: inset 0 1px 2px rgba(255,255,255,.4); }
.composer-color-name { color: var(--ink); font-size: .7rem; font-weight: 600; }
.write-studio .composer-photo-button, .write-studio .composer-remove { border-color: var(--studio-edge); box-shadow: inset 0 1px 0 var(--studio-glint), 0 3px 0 var(--studio-edge); transition: transform .18s ease, box-shadow .18s ease; }
.write-studio .composer-photo-button:hover, .write-studio .composer-remove:hover { transform: translateY(-2px); box-shadow: 0 5px 0 var(--studio-edge); }
.write-studio .word-counter-wrap { margin-top: 20px; }
.write-studio .word-progress { height: 7px; background: var(--studio-tint); box-shadow: inset 0 1px 3px var(--studio-depth); }
.write-studio #charHint, .write-studio #charCounter { font-size: .75rem; }
.write-studio .writing-submit {
    min-height: 56px; margin-bottom: 5px; border: 1px solid #0f766e; border-radius: 15px !important;
    background: linear-gradient(160deg, #159c89, #0f766e); font-size: .95rem; font-weight: 700;
    box-shadow: inset 0 2px 0 rgba(255,255,255,.18), 0 5px 0 #084e48, 0 14px 22px -14px rgba(15,118,110,.5);
    transition: transform .18s ease, box-shadow .18s ease;
}
.write-studio .writing-submit:hover { transform: translateY(-2px); box-shadow: inset 0 2px 0 rgba(255,255,255,.18), 0 7px 0 #084e48, 0 17px 24px -14px rgba(15,118,110,.5); }
.write-studio .writing-submit:active { transform: translateY(3px); box-shadow: 0 2px 0 #084e48; }
.write-studio .writing-submit:disabled { transform: none; opacity: .7; }
.write-studio .writing-submit:focus-visible { outline: 3px solid var(--brand-600); outline-offset: 5px; }
.writing-guidelines { margin-top: 42px; }
.guidelines-heading { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.guidelines-heading-icon { flex-basis: 40px; height: 40px; border-radius: 13px; color: #a76a16; }
.writing-guidelines h2 { margin: 0; color: var(--ink); font-size: 1.1rem; font-weight: 800; letter-spacing: -.025em; }
.writing-guidelines ol { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin: 0; padding: 0; list-style: none; counter-reset: writing-rule; }
.writing-guidelines li {
    counter-increment: writing-rule; display: flex; align-items: flex-start; gap: 13px; padding: 22px 20px;
    border: 1px solid var(--studio-edge); border-radius: 20px; background: linear-gradient(145deg, var(--card), var(--studio-tint));
    box-shadow: inset 0 2px 0 var(--studio-glint), 0 4px 0 var(--studio-edge), 0 14px 22px -18px var(--studio-depth);
    transition: transform .2s ease, box-shadow .2s ease;
}
.writing-guidelines li::before {
    content: '0' counter(writing-rule); display: grid; place-items: center; flex: 0 0 32px; height: 34px;
    border: 1px solid var(--studio-edge); border-radius: 10px; background: var(--card); color: var(--brand);
    box-shadow: inset 0 2px 0 var(--studio-glint), 0 2px 0 var(--studio-edge); font-size: .7rem; font-weight: 800;
}
.writing-guidelines h3 { margin: 2px 0 8px; color: var(--ink); font-size: .85rem; font-weight: 700; line-height: 1.5; }
.writing-guidelines p:not(.writing-panel-kicker) { margin: 0; color: var(--muted); font-size: .78rem; line-height: 1.85; }
@media (hover: hover) { .writing-guidelines li:hover { transform: translateY(-3px); box-shadow: inset 0 2px 0 var(--studio-glint), 0 7px 0 var(--studio-edge), 0 18px 26px -18px var(--studio-depth); } }
.write-studio .story-submitted { border-color: var(--studio-edge); box-shadow: inset 0 2px 0 var(--studio-glint), 0 6px 0 var(--studio-edge), 0 24px 48px -20px var(--studio-depth); }
[data-theme="dark"] .write-studio { --studio-edge: #2b4543; --studio-glint: rgba(255,255,255,.06); --studio-tint: #172725; --studio-depth: rgba(0,0,0,.5); }
[data-theme="dark"] .writing-eyebrow, [data-theme="dark"] .writing-panel-icon, [data-theme="dark"] .writing-guidelines li::before { color: #5eead4; }
[data-theme="dark"] .guidelines-heading-icon { color: #fbbf24; }
@media (max-width: 575.98px) {
    .write-studio { padding: 28px 0 48px; }
    .writing-intro { margin-bottom: 24px; }
    .writing-emblem { width: 52px; height: 52px; margin-bottom: 21px; border-radius: 17px; font-size: 1.35rem; }
    .writing-lead { max-width: 310px; font-size: .8rem; }
    .writing-eyebrow { font-size: .55rem; letter-spacing: .1em; }
    .writing-panel { padding: 16px; border-radius: 23px; }
    .writing-panel-heading { gap: 11px; margin-bottom: 20px; }
    .writing-panel-heading h2 { font-size: 1.05rem; }
    .writing-panel-note { display: none; }
    .writing-panel-kicker { font-size: .53rem; }
    .write-studio .story-composer { border-radius: 15px; }
    .write-studio .story-composer-tools { padding: 10px; gap: 8px; align-items: center; }
    .composer-toolbar-label { display: none; }
    .write-studio .composer-colors { flex: 1; }
    .write-studio .composer-color-swatch { width: 26px; height: 26px; }
    .write-studio #charHint, .write-studio #charCounter { font-size: .68rem; }
    .writing-guidelines { margin-top: 34px; }
    .writing-guidelines ol { grid-template-columns: 1fr; gap: 15px; }
    .writing-guidelines li { padding: 18px; }
}
@media (prefers-reduced-motion: reduce) {
    .write-studio .writing-submit, .write-studio .composer-photo-button, .write-studio .composer-remove, .writing-guidelines li { transition: none; }
    .write-studio .writing-submit:hover, .write-studio .composer-photo-button:hover, .write-studio .composer-remove:hover, .writing-guidelines li:hover { transform: none; }
}
@media (forced-colors: active) {
    .writing-emblem, .writing-panel, .writing-guidelines li, .write-studio .writing-submit { border-color: CanvasText; box-shadow: none; }
}
