html.chat-graffiti-open,body.chat-graffiti-open{overflow:hidden!important}
.chat-graffiti-modal[hidden]{display:none!important}
.chat-graffiti-modal{position:fixed;inset:0;z-index:2147483645;display:flex;align-items:center;justify-content:center;padding:16px;color:var(--ui-text,var(--site-ui-text,#0f172a));font-family:Inter,ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif}
.chat-graffiti-backdrop{position:absolute;inset:0;background:rgba(0,0,0,.5);backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);opacity:0;transition:opacity .2s ease}
.chat-graffiti-modal.is-open .chat-graffiti-backdrop{opacity:1}
.chat-graffiti-dialog{position:relative;z-index:1;width:min(720px,calc(100vw - 32px));max-height:calc(100dvh - 32px);display:flex;flex-direction:column;overflow:hidden;border:1px solid var(--ui-line,var(--site-ui-line,#e2e8f0));border-radius:28px;background:var(--ui-surface-solid,var(--site-ui-surface,#fff));box-shadow:var(--ui-shadow-popover,0 24px 64px rgba(15,23,42,.16));transform:translateY(12px) scale(.98);opacity:0;transition:transform .2s ease,opacity .2s ease}
.chat-graffiti-modal.is-open .chat-graffiti-dialog{transform:none;opacity:1}
.chat-graffiti-head{position:relative;min-height:62px;display:flex;align-items:center;justify-content:space-between;gap:14px;padding:11px 12px 11px 20px;border-bottom:1px solid var(--ui-line,var(--site-ui-line,#e2e8f0));background:var(--ui-surface-solid,var(--site-ui-surface,#fff))}
.chat-graffiti-head-copy{min-width:0;display:flex;flex-direction:column;gap:2px}
.chat-graffiti-head-copy strong{font-size:16px;line-height:1.25;font-weight:750;letter-spacing:-.01em;color:var(--ui-text,var(--site-ui-text,#0f172a))}
.chat-graffiti-head-copy span{font-size:12px;line-height:1.35;font-weight:500;color:var(--ui-text-secondary,var(--site-ui-muted,#64748b))}
.chat-graffiti-head-actions{display:flex;gap:5px}
.chat-graffiti-head-actions button{width:38px;height:38px;border:0;border-radius:14px;display:grid;place-items:center;background:transparent;color:var(--ui-text-secondary,var(--site-ui-muted,#64748b));transition:background .16s ease,color .16s ease,transform .16s ease}
.chat-graffiti-head-actions button:hover{background:var(--ui-surface-muted,var(--site-ui-surface-hover,#f1f5f9));color:var(--ui-text,var(--site-ui-text,#0f172a))}
.chat-graffiti-head-actions button:active{transform:scale(.96)}
.chat-graffiti-head-actions svg{width:19px;height:19px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.chat-graffiti-stage-wrap{min-height:0;flex:1;display:grid;place-items:center;padding:18px;background:var(--ui-bg-raised,var(--site-ui-surface-soft,#f8fafc))}
.chat-graffiti-stage{--graffiti-stage-bg:transparent;position:relative;width:min(100%,480px);aspect-ratio:1/1;border:1px solid var(--ui-line,var(--site-ui-line,#e2e8f0));border-radius:22px;overflow:hidden;background:var(--graffiti-stage-bg);box-shadow:0 8px 24px rgba(15,23,42,.08)}
.chat-graffiti-stage::before,.chat-graffiti-stage::after,.chat-photo-grid-item::before,.chat-selected-photo-thumb::before{content:"";position:absolute;inset:0;pointer-events:none}
.chat-graffiti-stage.is-transparent-bg::before,.chat-photo-grid-item::before,.chat-selected-photo-thumb::before{background-image:linear-gradient(45deg,rgba(15,23,42,.06) 25%,transparent 25%,transparent 75%,rgba(15,23,42,.06) 75%,rgba(15,23,42,.06)),linear-gradient(45deg,rgba(15,23,42,.06) 25%,transparent 25%,transparent 75%,rgba(15,23,42,.06) 75%,rgba(15,23,42,.06));background-position:0 0,10px 10px;background-size:20px 20px}
html.dark .chat-graffiti-stage{box-shadow:0 10px 28px rgba(0,0,0,.25)}
.chat-graffiti-canvas{position:relative;z-index:1;display:block;width:100%;height:100%;touch-action:none;cursor:crosshair;background:transparent}
.chat-graffiti-modal.is-eraser .chat-graffiti-canvas{cursor:cell}
.chat-graffiti-tools{padding:12px 14px 10px;border-top:1px solid var(--ui-line,var(--site-ui-line,#e2e8f0));background:var(--ui-surface-solid,var(--site-ui-surface,#fff))}
.chat-graffiti-option-row{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:10px}
.chat-graffiti-option-title{font-size:12px;font-weight:750;color:var(--ui-text-secondary,var(--site-ui-muted,#64748b))}
.chat-graffiti-bg-controls{display:flex;align-items:center;gap:8px;min-width:0}
.chat-graffiti-bg-chip,.chat-graffiti-bg-picker{position:relative;height:42px;padding:0 12px;border:1px solid var(--ui-line,var(--site-ui-line,#e2e8f0));border-radius:14px;background:var(--ui-surface-muted,var(--site-ui-surface-soft,#f8fafc));display:inline-flex;align-items:center;gap:9px;color:var(--ui-text,var(--site-ui-text,#0f172a));font-size:12px;font-weight:700;transition:background .16s ease,border-color .16s ease,color .16s ease,transform .16s ease}
.chat-graffiti-bg-chip:hover,.chat-graffiti-bg-picker:hover{background:var(--ui-bg-raised,var(--site-ui-surface-hover,#f1f5f9))}
.chat-graffiti-bg-chip:active,.chat-graffiti-bg-picker:active{transform:scale(.98)}
.chat-graffiti-bg-chip.is-active,.chat-graffiti-bg-picker.is-active{background:var(--ui-accent-soft,rgba(10,132,255,.11));border-color:rgba(10,132,255,.38);color:var(--ui-accent,#0a84ff)}
.chat-graffiti-bg-preview{--c:#ffffff;position:relative;display:inline-block;width:20px;height:20px;border-radius:50%;overflow:hidden;box-shadow:inset 0 0 0 1px rgba(15,23,42,.16),0 1px 3px rgba(15,23,42,.12);background:var(--c)}
.chat-graffiti-bg-preview.is-transparent{background-image:linear-gradient(45deg,rgba(15,23,42,.08) 25%,transparent 25%,transparent 75%,rgba(15,23,42,.08) 75%,rgba(15,23,42,.08)),linear-gradient(45deg,rgba(15,23,42,.08) 25%,transparent 25%,transparent 75%,rgba(15,23,42,.08) 75%,rgba(15,23,42,.08));background-position:0 0,6px 6px;background-size:12px 12px;background-color:#fff}
.chat-graffiti-bg-picker{padding-right:10px;cursor:pointer}
.chat-graffiti-bg-picker input{position:absolute;inset:0;opacity:0;cursor:pointer}
.chat-graffiti-bg-picker em,.chat-graffiti-bg-chip em{font-style:normal}
.chat-graffiti-brushes{height:60px;display:flex;gap:7px;overflow-x:auto;overflow-y:hidden;scrollbar-width:none;touch-action:pan-x}
.chat-graffiti-brushes::-webkit-scrollbar,.chat-graffiti-palette::-webkit-scrollbar{display:none}
.chat-graffiti-brush{width:84px;min-width:84px;height:56px;border:1px solid var(--ui-line,var(--site-ui-line,#e2e8f0));border-radius:16px;background:var(--ui-surface-muted,var(--site-ui-surface-soft,#f8fafc));padding:4px 6px;color:var(--ui-text-secondary,var(--site-ui-muted,#64748b));display:flex;flex-direction:column;align-items:stretch;justify-content:space-between;transition:background .16s ease,border-color .16s ease,color .16s ease,transform .16s ease}
.chat-graffiti-brush:hover{background:var(--ui-bg-raised,var(--site-ui-surface-hover,#f1f5f9))}
.chat-graffiti-brush:active{transform:scale(.98)}
.chat-graffiti-brush.is-active{background:var(--ui-accent-soft,rgba(10,132,255,.11));border-color:rgba(10,132,255,.38);color:var(--ui-accent,#0a84ff);box-shadow:none}
.chat-graffiti-brush em{height:17px;font-size:10px;font-style:normal;font-weight:750;display:grid;place-items:center}
.chat-graffiti-brush-preview{position:relative;height:29px;display:block}
.chat-graffiti-brush-preview:before,.chat-graffiti-brush-preview:after{content:"";position:absolute;left:10px;right:10px;top:14px;border-radius:999px;background:currentColor;height:3px}
.chat-graffiti-brush-preview.is-marker:before{height:6px;opacity:.48}.chat-graffiti-brush-preview.is-neon:before{height:9px;background:#64d2ff;opacity:.42;box-shadow:0 0 9px #64d2ff}.chat-graffiti-brush-preview.is-neon:after{height:2px;background:#fff;top:18px}.chat-graffiti-brush-preview.is-pencil:before{height:1px;opacity:.85}.chat-graffiti-brush-preview.is-pencil:after{height:1px;top:17px;opacity:.28;transform:translateX(3px)}.chat-graffiti-brush-preview.is-arrow:before{right:19px}.chat-graffiti-brush-preview.is-arrow:after{left:auto;right:12px;width:11px;height:11px;border-right:3px solid currentColor;border-top:3px solid currentColor;background:transparent;border-radius:0;transform:rotate(45deg);top:10px}.chat-graffiti-brush-preview.is-eraser:before{left:30px;right:auto;width:20px;height:11px;border-radius:4px;transform:rotate(-25deg);top:10px}.chat-graffiti-brush-preview.is-eraser:after{display:none}
.chat-graffiti-tool-row{min-width:0;display:flex;align-items:center;gap:10px;padding-top:8px}
.chat-graffiti-palette{min-width:0;flex:1;height:46px;display:flex;align-items:center;gap:5px;overflow-x:auto;scrollbar-width:none;touch-action:pan-x}
.chat-graffiti-color{--c:#fff;width:36px;height:36px;min-width:36px;border:0;background:transparent;position:relative;padding:0;border-radius:50%}
.chat-graffiti-color:before{content:"";position:absolute;inset:7px;border-radius:50%;background:var(--c);box-shadow:inset 0 0 0 1px rgba(15,23,42,.15),0 1px 3px rgba(15,23,42,.14)}
.chat-graffiti-color.is-active:before{inset:4px;box-shadow:0 0 0 2px var(--ui-surface-solid,#fff),0 0 0 4px var(--ui-text,#0f172a),inset 0 0 0 1px rgba(15,23,42,.15)}
.chat-graffiti-width{width:164px;min-width:164px;height:44px;padding:5px 10px;border:1px solid var(--ui-line,var(--site-ui-line,#e2e8f0));border-radius:14px;background:var(--ui-surface-muted,var(--site-ui-surface-soft,#f8fafc));display:grid;grid-template-columns:auto 1fr 25px;align-items:center;gap:8px;color:var(--ui-text,var(--site-ui-text,#0f172a))}
.chat-graffiti-width span{font-size:10px;font-weight:700;color:var(--ui-text-secondary,var(--site-ui-muted,#64748b))}
.chat-graffiti-width input{min-width:0;width:100%;accent-color:var(--ui-accent,#0a84ff)}
.chat-graffiti-width b{text-align:right;font-size:11px;font-weight:750}
.chat-graffiti-foot{min-height:66px;padding:10px 14px 12px;display:grid;grid-template-columns:1fr 1.65fr;gap:9px;border-top:1px solid var(--ui-line,var(--site-ui-line,#e2e8f0));background:var(--ui-surface-solid,var(--site-ui-surface,#fff))}
.chat-graffiti-foot button{height:44px;border-radius:14px;font-size:13px;font-weight:750;transition:background .16s ease,transform .16s ease,opacity .16s ease}
.chat-graffiti-foot button:active{transform:scale(.98)}
.chat-graffiti-cancel{border:1px solid var(--ui-line,var(--site-ui-line,#e2e8f0));background:var(--ui-surface-solid,var(--site-ui-surface,#fff));color:var(--ui-text,var(--site-ui-text,#0f172a))}
.chat-graffiti-cancel:hover{background:var(--ui-surface-muted,var(--site-ui-surface-hover,#f1f5f9))}
.chat-graffiti-send{border:1px solid var(--ui-accent,#0a84ff);background:var(--ui-accent,#0a84ff);color:#fff;box-shadow:none}
.chat-graffiti-send:hover{background:var(--ui-accent-hover,#0077ed);border-color:var(--ui-accent-hover,#0077ed)}
.chat-graffiti-send:disabled{opacity:.55}.chat-graffiti-send.is-loading:after{content:"";display:inline-block;width:13px;height:13px;margin-left:8px;vertical-align:-2px;border:2px solid rgba(255,255,255,.4);border-top-color:#fff;border-radius:50%;animation:chatGraffitiSpin .7s linear infinite}@keyframes chatGraffitiSpin{to{transform:rotate(360deg)}}
/* Selected previews and sent media get a subtle checkerboard so transparent PNG graffiti is visible. */
.chat-selected-photo-thumb,.chat-photo-grid-item{position:relative}
.chat-selected-photo-thumb img,.chat-photo-grid-item img{position:relative;z-index:1}
.chat-selected-photo-thumb.chat-attachment-kind-graffiti::after{content:"Граффити";position:absolute;left:4px;right:4px;bottom:4px;z-index:2;padding:2px 6px;border-radius:999px;background:rgba(15,23,42,.68);color:#fff;font-size:9px;line-height:1.4;font-weight:800;text-align:center;pointer-events:none;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
@media(max-width:700px){.chat-graffiti-modal{align-items:flex-end;padding:0}.chat-graffiti-dialog{width:100%;max-height:calc(100dvh - 12px);border-left:0;border-right:0;border-bottom:0;border-radius:28px 28px 0 0;transform:translateY(32px)}.chat-graffiti-head{min-height:58px;padding:9px 8px 9px 16px}.chat-graffiti-head:before{content:"";position:absolute;top:7px;left:50%;width:38px;height:4px;border-radius:999px;background:var(--ui-line-strong,rgba(15,23,42,.14));transform:translateX(-50%)}.chat-graffiti-head-copy{padding-top:5px}.chat-graffiti-head-copy span{display:none}.chat-graffiti-head-actions{padding-top:4px}.chat-graffiti-head-actions button{width:38px;height:38px}.chat-graffiti-stage-wrap{padding:10px 10px 12px}.chat-graffiti-stage{width:min(100%,calc(100dvh - 340px));max-width:540px;border-radius:18px}.chat-graffiti-tools{padding:9px 8px 7px}.chat-graffiti-option-row{align-items:flex-start;flex-direction:column;gap:6px}.chat-graffiti-bg-controls{width:100%;overflow-x:auto;padding-bottom:2px}.chat-graffiti-bg-chip,.chat-graffiti-bg-picker{height:40px;min-width:max-content}.chat-graffiti-brushes{height:56px}.chat-graffiti-brush{width:76px;min-width:76px;height:52px;border-radius:15px}.chat-graffiti-tool-row{gap:5px}.chat-graffiti-width{width:116px;min-width:116px;height:42px;grid-template-columns:1fr 22px}.chat-graffiti-width span{display:none}.chat-graffiti-color{width:34px;height:34px;min-width:34px}.chat-graffiti-foot{min-height:66px;padding:8px 8px max(10px,env(safe-area-inset-bottom))}.chat-graffiti-foot button{height:44px}}


/* iOS/Safari: after send the modal is torn down. During the 180ms fade-out it must not
   capture the next tap on the composer/attach button. */
.chat-graffiti-modal.is-closing{pointer-events:none!important}
