/* Runa Chat MediaViewer v1.0.0-beta */
body.media-viewer-open{overflow:hidden}
.media-viewer{--mv-drag-opacity:1;position:fixed;inset:0;z-index:10000;display:grid;grid-template-rows:auto 1fr auto;color:#fff;background:rgba(8,8,14,calc(.96 * var(--mv-drag-opacity)));backdrop-filter:blur(18px);animation:mvFade .16s ease-out}
@keyframes mvFade{from{opacity:0}to{opacity:1}}
.mv-topbar{position:relative;z-index:3;display:flex;align-items:center;justify-content:space-between;min-height:58px;padding:8px max(12px,env(safe-area-inset-right)) 8px max(16px,env(safe-area-inset-left));background:linear-gradient(180deg,rgba(0,0,0,.55),transparent)}
.mv-counter{min-width:60px;font-size:13px;font-weight:700;letter-spacing:.04em;color:rgba(255,255,255,.8)}
.mv-actions{display:flex;gap:6px}
.mv-actions button,.mv-nav{display:grid;place-items:center;width:42px;height:42px;padding:0;color:#fff;background:rgba(255,255,255,.1);border:1px solid rgba(255,255,255,.13);border-radius:50%;cursor:pointer;transition:background .15s ease,transform .15s ease}
.mv-actions button[hidden],.mv-nav[hidden]{display:none}
.mv-actions button:hover,.mv-nav:hover{background:rgba(255,255,255,.2);transform:scale(1.04)}
.mv-actions .mv-danger:hover{background:rgba(239,68,68,.42)}
.mv-actions svg,.mv-nav svg{width:20px;height:20px}
.mv-stage{position:relative;display:flex;align-items:center;justify-content:center;min-height:0;overflow:hidden;touch-action:none;cursor:zoom-in}
.media-viewer.is-zoomed .mv-stage{cursor:grab}
.mv-media{display:flex;align-items:center;justify-content:center;max-width:100%;max-height:100%;transform-origin:center;transition:transform .16s ease-out;will-change:transform}
.media-viewer.is-zoomed .mv-media{transition:none}
.mv-media img,.mv-media video{display:block;max-width:min(94vw,1600px);max-height:calc(100vh - 128px);object-fit:contain;border-radius:6px;box-shadow:0 18px 60px rgba(0,0,0,.45);user-select:none}
.mv-media video{width:min(94vw,1280px);background:#000}
.mv-nav{position:absolute;top:50%;z-index:4;transform:translateY(-50%)}
.mv-nav:hover{transform:translateY(-50%) scale(1.04)}
.mv-prev{left:18px}.mv-next{right:18px}
.mv-caption{position:relative;z-index:3;max-width:min(720px,92vw);min-height:36px;margin:0 auto;padding:8px 16px calc(10px + env(safe-area-inset-bottom));overflow:hidden;font-size:13px;text-align:center;text-overflow:ellipsis;white-space:nowrap;color:rgba(255,255,255,.78)}
.mv-caption.is-empty{visibility:hidden}
@media(max-width:768px){.mv-topbar{min-height:52px}.mv-actions button{width:38px;height:38px}.mv-nav{width:38px;height:38px;background:rgba(0,0,0,.34)}.mv-prev{left:8px}.mv-next{right:8px}.mv-media img,.mv-media video{max-width:100vw;max-height:calc(100vh - 110px);border-radius:0}.mv-caption{font-size:12px}}
.media-viewer.is-editing>.mv-topbar,.media-viewer.is-editing>.mv-stage,.media-viewer.is-editing>.mv-nav,.media-viewer.is-editing>.mv-caption{visibility:hidden}
.mv-editor{position:absolute;inset:0;z-index:8;display:grid;grid-template-columns:minmax(0,1fr) minmax(300px,390px);color:#162332;background:#070707}
.mv-editor-stage{display:grid;place-items:center;min-width:0;min-height:0;padding:24px;overflow:auto}
.mv-editor-canvas{display:grid;place-items:center;max-width:100%;max-height:100%}
.mv-editor canvas{display:block;max-width:100%;max-height:calc(100vh - 48px);object-fit:contain;touch-action:none;cursor:crosshair}
.mv-editor-panel{display:flex;flex-direction:column;min-height:0;overflow:auto;background:#fff}
.mv-editor-panel header{display:flex;align-items:center;gap:6px;min-height:62px;padding:8px 14px;border-bottom:1px solid #e6eaf0}
.mv-editor-panel header strong{flex:1;text-align:center}.mv-editor-panel button{cursor:pointer;font:inherit}
.mv-editor-panel header button{display:grid;place-items:center;width:34px;height:34px;border:0;border-radius:8px;background:transparent;color:#506276;font-size:23px}
.mv-editor-panel header button:hover{background:#f0f2f5}.mv-editor-panel header svg{width:20px;height:20px}
.mv-editor-panel nav{display:flex;border-bottom:1px solid #e6eaf0}.mv-editor-panel nav button{display:flex;align-items:center;justify-content:center;gap:6px;flex:1;padding:13px 7px;border:0;border-bottom:2px solid transparent;background:#fff;color:#536378}.mv-editor-panel nav button.active{color:#f58220;border-bottom-color:#f58220}.mv-editor-panel nav svg{width:17px;height:17px}
.mv-editor-draw,.mv-editor-crop{display:grid;gap:13px;align-content:start;padding:19px}.mv-editor-panel label{font-size:13px;color:#697588}.mv-editor-colors{display:flex;align-items:center;gap:6px;flex-wrap:wrap}.mv-editor-colors button{width:25px;height:25px;border:3px solid transparent;border-radius:50%}.mv-editor-colors button.active{outline:2px solid #f58220;outline-offset:2px}.mv-editor-colors input{width:30px;height:28px;padding:0;border:0;background:none}.mv-editor-draw input[type=range]{width:100%;accent-color:#f58220}.mv-editor-tools,.mv-editor-ratios{display:grid;gap:6px}.mv-editor-tools button,.mv-editor-ratios button,.mv-editor-rotate button{padding:10px 12px;border:0;border-radius:9px;background:#fff;color:#243143;text-align:left}.mv-editor-tools button:hover,.mv-editor-ratios button:hover,.mv-editor-rotate button:hover,.mv-editor-tools button.active,.mv-editor-ratios button.active{background:#f2f3f5}.mv-editor-ratios{grid-template-columns:repeat(2,minmax(0,1fr))}.mv-editor-ratios button:first-child,.mv-editor-ratios button:nth-child(2){grid-column:span 2}.mv-editor-crop p{font-size:12px;color:#697588}.mv-editor-rotate{display:flex;gap:8px}.mv-editor-rotate button{flex:1;background:#f3f6f9;text-align:center}.mv-editor-panel footer{margin-top:auto;padding:14px;border-top:1px solid #e6eaf0}.mv-editor-panel footer button{width:100%;padding:12px;border:0;border-radius:10px;background:#f58220;color:#fff;font-weight:700}.mv-editor-panel .hidden{display:none}
@media(max-width:768px){.mv-editor{grid-template-columns:1fr;grid-template-rows:minmax(0,1fr) minmax(180px,40vh)}.mv-editor-stage{padding:10px}.mv-editor canvas{max-height:calc(60vh - 24px)}.mv-editor-panel header{min-height:46px}.mv-editor-draw,.mv-editor-crop{padding:9px;gap:7px}.mv-editor-tools{grid-template-columns:repeat(3,1fr)}.mv-editor-tools button{font-size:11px}}
