
/* Keep contextual menus close to their opener, never full-page dialogs. */
dialog.fox-anchored{position:fixed!important;inset:auto;margin:0!important;transform:none!important;max-width:calc(100vw - 16px);border-radius:10px;overflow:auto}
dialog.fox-anchored::backdrop{background:transparent}dialog.fox-account-menu{width:max-content;min-width:180px;max-width:min(230px,calc(100vw - 16px))}dialog.fox-notice-menu{width:min(290px,calc(100vw - 16px))}
dialog.fox-anchored .dialog-head{padding:7px 10px;min-height:35px}dialog.fox-anchored .dialog-head h3{font-size:13px}dialog.fox-anchored .dialog-head button{width:25px;height:25px;min-width:25px;padding:3px}dialog.fox-anchored .dialog-body{padding:6px;max-height:calc(100dvh - 105px);overflow:auto}
dialog.fox-form-modal{width:min(350px,calc(100vw - 28px))!important;max-width:calc(100vw - 28px);max-height:calc(100dvh - 28px);margin:auto;inset:0;border-radius:12px}
.fox-form-modal .dialog-head{min-height:42px;padding:9px 12px;border:0}.fox-form-modal .dialog-head h3{font-size:14px}.fox-form-modal .dialog-head button{min-width:26px;width:26px;height:26px;padding:3px}.fox-form-modal .dialog-body{padding:4px 12px 12px}
.fox-form{display:grid;gap:12px;font-size:12px}.fox-form-target{display:flex;gap:9px;align-items:center;background:var(--raised);padding:9px;border-radius:8px}.fox-form-target>div{display:grid;gap:3px;min-width:0}.fox-form-target b{font-size:12px}.fox-form-target small{font-size:11px;color:var(--muted)}.fox-target-icon{display:grid;place-items:center;background:var(--surface);width:32px;height:32px;border-radius:5px;flex:none}.fox-form label{display:grid;gap:7px;color:var(--muted);font-weight:600;font-size:12px}.fox-form select{border-radius:999px;min-height:36px}.fox-form :is(input,select,textarea){padding:8px 10px;font-size:12px;width:100%}.fox-form textarea{min-height:76px;resize:vertical}.fox-form-actions{display:grid;grid-template-columns:1fr 1fr;gap:7px}.fox-form button{font-size:12px;min-height:32px;border-radius:6px}.fox-form>small{font-size:10px;color:var(--muted)}.fox-support-target{background:transparent;padding:4px 0 10px;border-bottom:1px solid var(--border);border-radius:0}.fox-support-target img{width:43px;height:60px;object-fit:cover;border-radius:5px}.fox-balance{display:flex;justify-content:space-between;align-items:center;padding:7px 0;color:var(--muted)}.fox-balance b{color:#fbbf24;font-weight:600}
.fox-emoji-picker{display:grid;grid-template-rows:auto auto minmax(0,1fr);gap:5px;min-height:0;overflow:hidden;background:var(--raised);border:1px solid var(--border);border-radius:7px;padding:5px;grid-column:1/-1}.fox-emoji-top{display:flex;gap:4px}.fox-emoji-top input{width:100%;min-width:0;font-size:11px;padding:4px 7px;min-height:26px}.fox-emoji-picker button{padding:3px;min-width:0;min-height:25px;border:0;background:transparent;line-height:1.2}.fox-emoji-cats{display:flex;gap:2px;justify-content:space-between}.fox-emoji-cats button.selected,.fox-emoji-grid button:hover{background:var(--accent-soft)}.fox-emoji-grid{display:grid;grid-template-columns:repeat(8,minmax(0,1fr));gap:2px;overflow:auto;align-content:start}.fox-emoji-grid button{font-size:17px}.fox-emoji-top button .ic{width:13px;height:13px}
@media(min-width:701px){.reference-work .comment-compose #comment-form{min-height:220px}.reference-work .comment-compose #comment-form.emoji-open{grid-template-rows:minmax(48px,.55fr) minmax(100px,1fr) auto;gap:5px}.reference-work .comment-compose #comment-form.emoji-open textarea{min-height:45px;height:auto;resize:none}.reference-work .comment-compose #comment-form.emoji-open>button{grid-row:3}}
@media(max-width:700px){dialog.fox-notice-menu{width:min(255px,calc(100vw - 16px))}.fox-form{gap:9px}.fox-form-modal .dialog-body{padding:4px 10px 10px}.fox-emoji-picker{display:none}}

/* Compact global account and notification menus, identical on reader and catalog routes. */
body dialog.fox-anchored.fox-account-menu{width:max-content!important;min-width:155px!important;max-width:min(190px,calc(100vw - 16px))!important}
body dialog.fox-anchored.fox-notice-menu{width:min(270px,calc(100vw - 16px))!important;max-height:370px!important;overflow:hidden}
body dialog.fox-anchored .dialog-head{min-height:31px;padding:5px 8px!important}body dialog.fox-anchored .dialog-head h3{font-size:12px!important}body dialog.fox-anchored .dialog-head button{width:22px;height:22px;min-width:22px}
body dialog.fox-account-menu .dialog-body{padding:4px!important;gap:1px}body dialog.fox-account-menu .dialog-body :is(a,button){display:flex;align-items:center;gap:6px;font-size:11px!important;line-height:1.3;min-height:26px;padding:5px 7px!important;border-radius:5px}
body dialog.fox-notice-menu .dialog-body{display:flex!important;flex-direction:column;gap:3px;padding:4px!important;max-height:330px!important;overflow:hidden!important}
.fox-notice-menu :is(.fox-notice-scroll,.review-notice-list){flex:1;min-height:0;overflow-y:auto;scrollbar-width:thin}.fox-notice-menu .dialog-body> :not(.fox-notice-scroll):not(.review-notice-list){flex-shrink:0}
body dialog.fox-notice-menu .notice{padding:5px!important;gap:5px!important;min-height:0}.fox-notice-menu .notice .grow{display:grid;gap:2px}.fox-notice-menu .notice b{font-size:11px!important;line-height:1.3}.fox-notice-menu .notice :is(p,small,a){font-size:10px!important;line-height:1.35;margin:0!important}.fox-notice-menu .notice :is(img,.avatar){width:27px!important;height:31px!important;flex:none;object-fit:cover}.fox-notice-menu .notice button{min-height:22px;padding:3px 5px;font-size:10px}.fox-notice-menu .dialog-body :is(.subtabs,.review-notice-top){gap:3px;flex-wrap:nowrap}.fox-notice-menu .dialog-body>button,.fox-notice-menu [data-action=notifications-full]{font-size:10px;min-height:26px;padding:4px 6px}.fox-notice-menu [data-action=notice-all]{font-size:10px;padding:3px 4px}
@media(max-width:700px){body dialog.fox-anchored.fox-notice-menu{width:min(225px,calc(100vw - 16px))!important;max-height:300px!important}body dialog.fox-notice-menu .dialog-body{max-height:260px!important}body dialog.fox-anchored.fox-account-menu{min-width:140px!important;max-width:172px!important}}
@media(min-width:701px){.reference-work .comment-compose .row#comment-form.emoji-open{height:var(--compose-height,220px);max-height:var(--compose-height,220px);min-height:0!important;flex:none!important;grid-template-rows: minmax(36px,52px) minmax(0,1fr) 34px!important;align-items:stretch;gap:5px!important;overflow:hidden}.reference-work .comment-compose .row#comment-form.emoji-open textarea{grid-row:1;height:100%!important;min-height:0!important;max-height:none!important;padding:7px 9px}.reference-work .comment-compose .row#comment-form.emoji-open .fox-emoji-picker{grid-row:2;min-height:0;max-height:100%;align-self:stretch}.reference-work .comment-compose .row#comment-form.emoji-open>button{grid-row:3;align-self:center}.fox-emoji-grid{min-height:0}.fox-emoji-grid button{font-size:15px;min-height:23px}.fox-emoji-cats button{min-height:22px}}

/* Single scrolling region: touch and wheel work independently of fixed header/footer. */
body dialog.fox-notice-menu{display:flex!important;flex-direction:column;overflow:hidden!important}
body dialog.fox-notice-menu:not([open]){display:none!important}
body dialog.fox-notice-menu .dialog-head{flex:0 0 auto}
body dialog.fox-notice-menu .dialog-body{flex:1 1 auto;min-height:0!important;overflow:hidden!important;max-height:none!important}
body dialog.fox-notice-menu .fox-notice-toolbar{display:flex;align-items:center;flex-wrap:wrap;gap:3px;flex:0 0 auto;padding:2px}
body dialog.fox-notice-menu .fox-notice-toolbar :is(.subtabs,.review-notice-top){flex:1;min-width:0;margin:0;padding:0;gap:2px}
body dialog.fox-notice-menu .fox-notice-toolbar button{font-size:10px;min-height:24px;padding:3px 5px}
body dialog.fox-notice-menu .fox-notice-scroll{flex:1 1 auto;min-height:0;overflow-y:auto!important;overflow-x:hidden;touch-action:pan-y!important;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;scrollbar-width:thin}
body dialog.fox-notice-menu .fox-notice-scroll>*{flex-shrink:0}
@media(max-width:700px){body #sidebar{width:max-content!important;min-width:200px;max-width:min(228px,72vw)!important;padding-inline:12px!important}body #sidebar .sidebar-identity b{font-size:14px!important;white-space:nowrap}body #sidebar .sidebar-group .nav-item{padding-inline:6px!important;font-size:12px}body #sidebar .sidebar-bottom{gap:8px}body #sidebar .sidebar-identity .avatar{width:46px;height:46px}body dialog.fox-notice-menu .fox-notice-scroll{max-height:205px}}
