/* Shared content gutter sits inside the painted band, including its overhang. */
#sheet,#rail-underlay{--content-inset:16px;padding:8px var(--content-inset) 10px}
#panel-modal #sheet{padding:8px var(--content-inset) 10px}
#sheet .sheet-heading,#rail-underlay .sheet-heading{grid-template-columns:44px minmax(0,1fr) 44px;gap:8px;min-height:56px;height:56px;box-sizing:border-box;margin:0 0 10px;padding:0 0 8px;align-items:center;border-bottom:1px solid #a98c5355}
#sheet .sheet-heading h2,#sheet:not([data-view=detail]) .sheet-heading h2,#rail-underlay .sheet-heading h2{display:block;grid-area:1/2;position:static;justify-self:stretch;min-width:0;width:auto;max-width:none;margin:0;padding:0;background:none;color:#eddbb0;text-align:center;font:600 22px/1.3 "Songti TC","Noto Serif TC",serif;letter-spacing:.1em;white-space:nowrap}
#sheet .sheet-heading h2>.icon{display:none}
#sheet .sheet-heading #sheet-close{display:grid;place-items:center;align-self:center;padding:10px;width:44px;height:44px;margin:0}
.close-mark{position:relative;display:block;flex:none;width:24px;height:24px;font-size:0;line-height:0}
.close-mark:before,.close-mark:after{content:'';display:block;position:absolute;left:50%;top:50%;width:23px;height:3px;margin:-1.5px 0 0 -11.5px;border-radius:2px;background:#efddb3;transform:rotate(45deg)}
.close-mark:after{transform:rotate(-45deg)}
#sheet-close .close-mark,#confirm-close .close-mark,#atlas-close .close-mark{width:24px;height:24px}
#atlas-close,#confirm-close{display:grid;place-items:center;padding:10px}
#detail-back{max-width:44px;min-width:44px;padding:0;justify-content:center}
#detail-back span:not(.icon){display:none}
#menu-navigation{padding:0 0 10px;min-height:54px}
#menu-tabs{width:100%;gap:4px}
#menu-tabs button{font-size:13px}
.sheet-scroll{padding:12px 0 6px}
#sheet[data-view=auto] .sheet-scroll{padding-left:0;padding-right:0}
.paperdoll-avatar{top:16px;bottom:24px;display:grid;place-items:center}
.paperdoll-avatar .character-art{width:100%;height:100%}
.hud-top .portrait .rabbit-portrait{width:100%;height:100%;max-width:100%;max-height:100%}
#menu-button .icon{width:74%;height:74%}
#minimap image,#atlas-map image{filter:none}
/* The hotbars and desktop chat never reflow when a right rail opens. */
#game[data-layout=wide] .hud-bottom{left:50%}
.hud-bottom{z-index:2}
#sheet-layer{z-index:40}
#rail-underlay{z-index:39}
#game[data-layout=wide] #desktop-chat{left:20px;bottom:22px;width:var(--chat-width);height:254px}
#game[data-layout=wide] #chat-preview{left:20px;bottom:22px;width:var(--chat-width)}
.rest-action{position:absolute;left:-62px;top:50%;transform:translateY(-50%);width:48px;height:48px;min-width:44px;min-height:44px;padding:10px;border:0;border-radius:0;background:transparent var(--carved-tool) center/100% 100% no-repeat;box-shadow:none;isolation:isolate}
.rest-action:before{content:'';position:absolute;inset:13%;background:#0b2429;clip-path:polygon(12% 0,88% 0,100% 12%,100% 88%,88% 100%,12% 100%,0 88%,0 12%);z-index:-1;pointer-events:none}
.rest-action .icon{width:100%;height:100%}
.rest-action[aria-pressed=true]:before{background:#265448}
.portrait-actions{position:absolute;left:0;top:calc(100% + 12px);width:184px;box-sizing:border-box;padding:10px;display:grid;gap:5px;border:10px solid transparent;border-image:var(--carved-panel) 115 / 13px stretch;background:#0b2528;background-clip:padding-box;z-index:30;box-shadow:0 5px 12px #0006}
.portrait-actions button{min-height:44px;justify-content:flex-start;padding:5px 8px;border:0;background:none;gap:8px;font-size:14px}
.portrait-actions .icon{width:25px;height:25px}
/* PNG alpha owns the outline. A hover never fills its rectangular canvas. */
.hud-tools button,.hud-tools button:hover:not(:disabled),.hud-tools button[aria-pressed=true],.rest-action,.rest-action:hover:not(:disabled){background-color:transparent;box-shadow:none}
@media(hover:hover) and (pointer:fine){
 .hud-tools button:not(:disabled):hover,.skill-bar button:not(:disabled):hover,.rest-action:not(:disabled):hover,.hud-top .portrait:hover:not(:disabled){opacity:.84;filter:none;box-shadow:none;background-color:transparent}
}
/* Persistent, nonmodal chat: expand explicitly; the transcript never opens a sheet. */
#chat-preview{position:absolute;display:flex;flex-direction:column;align-items:stretch;justify-content:flex-start;gap:3px;box-sizing:border-box;height:100px;max-height:none;overflow:hidden;padding:4px 8px;border:7px solid transparent;border-image:var(--carved-panel) 115 / 10px stretch;background:#071d226b;background-clip:padding-box;box-shadow:none;text-align:left;z-index:15;pointer-events:auto}
#chat-preview:before{display:none}
.chat-preview-heading{display:flex;align-items:center;gap:8px;min-height:24px;color:#e7cc90;font-size:11px;flex:none}
.chat-preview-label{font-size:11px}
#chat-expand{margin-left:auto;min-width:44px;width:44px;min-height:28px;height:28px;padding:0;border:0;background:none;box-shadow:none;font-size:22px;color:#ebd6a7}
#chat-preview-unread{position:static;font-size:10px;color:#f8df9a}
#chat-preview-text{display:flex;flex-direction:column;gap:2px;min-height:0;overflow:hidden;max-width:100%;font-size:12px;line-height:1.4;color:#e3dfce;text-shadow:0 1px 2px #000}
#chat-preview-text p{margin:0;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;min-height:17px;line-height:17px;font-size:12px}
#chat-preview-text strong{color:#bcd4ba;font-weight:500}
#desktop-chat .chat-tabs button[aria-selected=true]{background:#345d4c;border-color:#edc67e;color:#ffedbc;box-shadow:inset 0 -3px #edc67e;font-weight:700}
#desktop-chat .chat-tabs button[aria-selected=false]{color:#adb7ac;background:#0a2025;border-color:#596552}
#desktop-chat .chat-tabs button{min-width:0}
#whisper-recipient{display:block;margin-bottom:6px}
#chat-recipient-trigger{display:flex;align-items:center;gap:8px;width:100%;min-height:36px;height:36px;padding:4px 8px;border:1px solid #9a8252;border-radius:4px;background:#15352f;font-size:12px}
#chat-recipient-trigger small{color:#b7c1ac;font-size:10px;white-space:nowrap}
#chat-recipient-trigger strong{font-size:12px;min-width:0;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;font-weight:500}
#chat-recipient-trigger>span{margin-left:auto;flex:none;color:#edcf92}
#chat-recipient-picker{position:absolute;inset:8px;z-index:30;display:flex;flex-direction:column;gap:8px;padding:10px;border:1px solid #c5a26a;border-radius:6px;background:#0b2528;box-shadow:0 3px 12px #0009;box-sizing:border-box}
.recipient-search-row{display:flex;gap:6px;flex:none}
#chat-recipient-search{width:100%;min-width:0;min-height:38px;height:38px;font-size:16px;padding:5px 8px}
#chat-recipient-close{display:grid;place-items:center;flex:none;min-width:38px;width:38px;min-height:38px;height:38px;padding:6px;border:0;background:none}
#chat-recipient-list{flex:1;min-height:0;overflow:auto;scrollbar-width:thin}
#chat-recipient-list>button{display:flex;align-items:center;gap:10px;min-height:44px;width:100%;justify-content:flex-start;border:0;border-bottom:1px solid #68806c44;background:transparent;border-radius:0;padding:5px 6px;text-align:left}
#chat-recipient-list>button[aria-selected=true]{background:#2b5042;color:#f3d99f}
.recipient-mark{display:grid;place-items:center;width:27px;height:27px;flex:none;border:1px solid #a88e59;border-radius:50%;background:#365243;color:#ead8ac;font-size:13px}
.recipient-note,.recipient-empty{font-size:11px;line-height:1.5;margin:0;color:#acb8a6}
.recipient-empty{padding:10px 3px}
@media(max-width:1199px) and (min-width:1000px) and (min-height:650px){#game[data-layout=wide] #desktop-chat{left:16px;bottom:22px;width:270px;height:230px}}
@media(max-width:999px),(max-height:649px){
 #sheet,#rail-underlay{--content-inset:16px}
 #panel-modal #sheet{padding:6px var(--content-inset) 8px}
 #game #desktop-chat{display:block;position:absolute;left:12px;bottom:194px;width:min(390px,calc(100% - 24px));height:216px;padding:4px 5px;border-width:10px;border-image-width:15px;background:#0a2025e8;z-index:15}
 #desktop-chat:after{display:none}
 #desktop-chat .chat-tabs{min-height:38px;padding:0 34px 5px 0}
 #desktop-chat .chat-tabs button{min-height:36px;font-size:12px}
 #desktop-chat-collapse{right:2px;top:3px;min-width:32px;width:32px;min-height:36px;height:36px}
 #desktop-chat #chat-log,#desktop-chat #chat-log p{font-size:12px;line-height:1.45}
 #desktop-chat #chat-log time{display:none}
 #desktop-chat .chat-party-link{display:none}
 #desktop-chat .chat-form{padding-top:5px}
 #desktop-chat #chat-text{font-size:16px;min-height:40px;height:40px}
 #desktop-chat .chat-compose button{min-width:46px;width:46px;min-height:40px;height:40px;font-size:12px}
 #game #chat-preview{left:12px;bottom:194px;width:min(390px,calc(100% - 24px));height:120px}
 #chat-expand{min-height:44px;height:44px}
 #rest-button{display:none}
 #game.compact-keyboard #desktop-chat{height:160px;bottom:174px}
 #game.compact-keyboard #chat-preview{height:84px;bottom:174px}
 #game.compact-keyboard .hud-top{visibility:hidden}
}
@media(max-width:599px){
 #panel-modal #sheet{--content-inset:18px;padding:6px var(--content-inset) 8px}
 #sheet .sheet-heading{grid-template-columns:44px minmax(0,1fr) 44px;min-height:56px;margin-bottom:10px}
 #sheet .sheet-heading h2,#sheet:not([data-view=detail]) .sheet-heading h2{font-size:21px}
 #menu-tabs button{font-size:12px}
 #game #desktop-chat,#game #chat-preview{width:calc(100% - 84px)}
}
