.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
#hud .chat-composer { padding: 8px 12px 5px; border-top: 3px double #9a825650; }
#hud .chat-connection, #hud .chat-input-hint { display: flex; justify-content: space-between; align-items: center; gap: 6px; font-size: 10px; }
#hud .chat-connection { margin-bottom: 7px; font-variant: small-caps; }
#hud .chat-connection button { padding: 2px 5px; border-bottom: 1px solid #947e50; font-size: 10px; }
#hud .chat-input-row { display: flex; border: 1px solid #93713f70; background: #faf1db75; }
#hud .chat-input-row input { flex: 1; width: 0; border: 0; padding: 8px; background: transparent; color: #423a29; font: 12px Georgia, serif; }
#hud .chat-input-row button { padding: 5px; width: 30px; }
#hud .chat-input-hint { margin-top: 5px; opacity: .8; }
#hud #social-feedback { font-size: 11px; color: #843c32; padding-top: 4px; overflow-wrap: anywhere; }
#hud .chat-lines .social-message { display: block; overflow-wrap: anywhere; line-height: 1.5; margin: 0; padding: 5px 0; }
#hud .social-message strong { margin-right: 5px; color: #7b4030; }
#hud .dialogue-faces { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
#hud .dialogue-faces figure { margin: 0; width: 116px; text-align: center; opacity: .7; }
#hud .dialogue-faces figure.speaking { opacity: 1; }
#hud .dialogue-faces img { display: block; width: 106px; height: 103px; object-fit: cover; border: 3px double #a18a60; border-radius: 48% 48% 3px 3px; background: radial-gradient(ellipse, #ddcba57a, #806c4740); }
#hud .dialogue-faces figure.speaking img { border-color: #6d794e; box-shadow: 0 0 0 3px #6f7d4225; }
#hud .dialogue-faces figcaption { margin-top: 7px; font-size: 13px; font-weight: bold; }
#hud .dialogue-faces small { display: block; font-size: 10px; font-weight: normal; letter-spacing: 1px; margin-top: 3px; }
#hud .dialogue-thread { display: flex; align-items: center; gap: 12px; font-size: 10px; color: #917346; text-align: center; }
#hud .dialogue-thread span { font-size: 12px; font-style: italic; }
/* A fixed conversation leaf at the Chronicle's corner. Keep every turn in the
   same frame, with just the active speaker's head visible. */
#hud .dialogue-dock { background: none; backdrop-filter: none; pointer-events: none; animation: none; }
#hud .social-dialogue {
  position: absolute; left: 28px; bottom: 28px; width: 560px; height: 244px;
  max-width: calc(100vw - 56px); max-height: calc(100dvh - 32px);
  padding: 0; pointer-events: auto; animation: none; transform: none;
  background: repeating-linear-gradient(4deg, #826b4206 0 1px, transparent 1px 4px), linear-gradient(105deg, #d3c3a2, #e5d7ba 35%, #daceb1);
  backdrop-filter: none; -webkit-backdrop-filter: none;
}
#hud .social-dialogue > header { display: contents; }
#hud .social-dialogue > header > div, #hud .social-dialogue > footer { display: none; }
#hud .social-dialogue > header button { position: absolute; top: 13px; right: 15px; z-index: 1; margin: 0; padding: 2px; }
#hud .social-dialogue > header .icon { width: 16px; height: 16px; }
#hud .social-dialogue .panel-body { display: grid; grid-template-columns: 180px minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); gap: 8px 14px; height: 100%; padding: 14px 20px; overflow: hidden; background: none; }
#hud .social-dialogue .dialogue-head { position: absolute; left: 20px; top: 50%; transform: translateY(-50%); width: 180px; height: 180px; }
#hud .social-dialogue .dialogue-head > :is(img, span) { position: absolute; inset: 0; margin: auto; width: 100%; height: 100%; object-fit: contain; }
#hud .social-dialogue .dialogue-head .icon { width: 70%; height: 100%; }
#hud .social-dialogue .dialogue-head .icon-art { width: 100%; }
/* The ward's dark behind the ward's dead: a pale figure will not read on pale parchment. */
#hud .social-dialogue .dialogue-head img[data-ghost] { box-sizing: border-box; height: auto; aspect-ratio: 1; border: 2px solid #8a7445; border-radius: 50%; background: radial-gradient(circle closest-side, #3e6660 0 26%, #203a38 74%, #182b2a); }
#hud .social-dialogue .dialogue-turn { grid-column: 2; grid-row: 2; display: grid; grid-template-rows: minmax(0, 1fr) auto; gap: 6px; min-width: 0; min-height: 0; text-align: center; }
#hud .social-dialogue .dialogue-speaker { grid-column: 1 / -1; grid-row: 1; text-align: center; color: #8a3023; font: 24px/1.2 'Greenvale Serif', Georgia, serif; margin: 0; padding-inline: 12px; }
#hud .social-dialogue .dialogue-speech { display: grid; align-content: safe center; overflow: auto; scrollbar-gutter: stable both-edges; font: 17px/1.4 Georgia, serif; }
#hud .social-dialogue .dialogue-speech p { margin: 0; }
#hud .social-dialogue .dialogue-speech p + p { margin-top: 10px; }
#hud .social-dialogue .dialogue-options { display: grid; gap: 2px; max-height: min(220px, 50dvh); overflow: auto; margin: 0; padding: 0; border: 0; }
#hud .social-dialogue .dialogue-options button { display: block; width: 100%; padding: 4px 8px; background: none; border: 0; border-radius: 2px; box-shadow: none; color: #293f9b; font: 16px/1.3 Georgia, serif; }
#hud .social-dialogue .dialogue-options button span { color: inherit; margin-right: 7px; }
#hud .social-dialogue .dialogue-options.tight { gap: 0; }
#hud .social-dialogue .dialogue-options.tight button { padding-block: 1px; line-height: 1.2; }
#hud .social-dialogue .dialogue-options button[data-continue] { text-align: center; }
#hud .social-dialogue .dialogue-options button:hover { background: #bba57930; color: #172c83; }
#hud .social-dialogue .dialogue-options button:focus-visible { outline: 1px dotted #6b623f; outline-offset: -1px; }
#hud:has(.social-dialogue) :is(.chat, .chronicle-tab, .actionbar) { visibility: hidden; }
/* Pictures laid beside a line (Elara's two leaves), and the leaf stepping aside
   while the traveller does something with their hands. */
#hud .social-dialogue .dialogue-show { display: flex; justify-content: center; align-items: end; gap: 26px; margin: 0 0 8px; }
#hud .social-dialogue .dialogue-show figure { display: grid; justify-items: center; gap: 3px; margin: 0; }
#hud .social-dialogue .dialogue-show .icon { width: 86px; height: 86px; filter: drop-shadow(0 2px 2px #5a452a44); }
#hud .social-dialogue .dialogue-show figcaption { color: #6b5536; font: italic 13px/1.2 Georgia, serif; }
#hud .social-dialogue { transition: opacity .3s ease; }
#hud .social-dialogue.dialogue-away { opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .22s ease, visibility 0s .22s; }
@media(max-width: 1000px) {
  #hud .social-dialogue { left: 14px; bottom: 14px; max-width: calc(100vw - 28px); }
}
@media(max-width: 600px) {
  #hud .social-dialogue { height: 244px; }
  #hud .social-dialogue .panel-body { grid-template-columns: 120px minmax(0, 1fr); gap: 6px; padding: 14px; }
  #hud .social-dialogue .dialogue-head { left: 14px; width: 120px; height: 150px; }
  #hud .social-dialogue .dialogue-speaker { font-size: 22px; }
  #hud .social-dialogue .dialogue-speech { font-size: 16px; }
  #hud .social-dialogue .dialogue-options button { font-size: 16px; padding: 6px 3px; }
}
#hud .account-panel { max-width: 470px; }
#hud .account-panel label { display: block; margin: 16px 0; font-size: 12px; }
#hud .account-panel input { display: block; box-sizing: border-box; width: 100%; margin-top: 6px; border: 1px solid #9b7b4e80; padding: 11px; background: #f6ebd480; color: #423323; font: 14px Georgia, serif; }
#hud .account-actions { display: flex; gap: 12px; }
#hud .account-footnote, #hud .account-intro { font-size: 13px; line-height: 1.6; }
#hud #account-feedback { color: #923f31; font-size: 13px; }
.social-world-layer { position: absolute; inset: 0; pointer-events: none; }
.remote-player-label, .player-bubble { position: absolute; transform: translate(-50%, -100%); text-align: center; }
.remote-player-label { pointer-events: auto; display: flex; flex-direction: column; gap: 3px; background: #26352ddd; padding: 5px 10px; border: 1px solid #b09b6350; border-radius: 3px; color: #f4e7c4; font: 12px Georgia, serif; white-space: nowrap; }
.remote-player-label span { font-size: 10px; }
.player-bubble { max-width: 240px; width: max-content; background: #f7edcfed; color: #403525; padding: 9px 12px; border: 1px solid #ab8d59; border-radius: 9px; font: 13px/1.4 Georgia, serif; box-shadow: 0 3px 10px #0003; overflow-wrap: anywhere; }
.player-bubble::after { content: ''; position: absolute; top: 100%; left: calc(50% - 5px); border: 5px solid transparent; border-top-color: #f7edcf; }
.player-menu, .player-tooltip { position: fixed; pointer-events: auto; z-index: 80; background: #26352df5; color: #f4e7c4; border: 2px double #b79c64; box-shadow: 0 5px 15px #0004; padding: 10px; min-width: 165px; font: 13px Georgia, serif; }
.player-tooltip { pointer-events: none; display: flex; flex-direction: column; gap: 4px; min-width: 0; max-width: min(240px, calc(100vw - 16px)); padding: 8px 10px; }
.player-tooltip-title { display: flex; align-items: baseline; gap: 14px; justify-content: space-between; }
.player-tooltip-title strong { overflow-wrap: anywhere; }
.player-tooltip-title span { white-space: nowrap; }
.player-tooltip small { font-size: 11px; color: #cbbc99; }
.player-menu header { display: flex; flex-direction: column; gap: 5px; border-bottom: 1px solid #aa996350; padding-bottom: 9px; }
.player-menu button { display: block; padding: 9px; width: 100%; text-align: left; color: #f4e7c4; }
.player-menu button:hover { background: #68705280; }
.trade-invitation { position: absolute; top: 90px; left: 50%; transform: translateX(-50%); z-index: 75; pointer-events: auto; background: #e2d5bbed; color: #4b3827; border: 3px double #9c7d4d; box-shadow: 0 7px 20px #0003; padding: 17px 22px; width: min(360px, 85vw); }
.trade-invitation small, .trade-invitation strong { display: block; margin-bottom: 7px; }
.trade-invitation small { letter-spacing: 2px; font-size: 9px; }
.trade-invitation p { font-size: 12px; line-height: 1.4; }
.trade-invitation div { display: flex; gap: 12px; }
.trade-invitation button { padding: 7px 18px; border: 1px solid #8c734b80; background: #f5e8c650; }
#hud .trade-panel { width: min(860px, 94vw); max-width: 860px; }
#hud .trade-steps { display: flex; justify-content: center; align-items: center; gap: 24px; padding: 6px 0 16px; font-size: 13px; }
#hud .trade-steps span { opacity: .5; } #hud .trade-steps span.current { opacity: 1; color: #823f2f; }
#hud .trade-steps b { margin-left: 6px; }
#hud .trade-intro, #hud .trade-review-note { font-size: 13px; line-height: 1.55; margin: 0 0 15px; }
#hud .trade-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
#hud .trade-side { border: 3px double #9e845b70; background: #c8b99320; min-width: 0; }
#hud .trade-side header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; padding: 10px; gap: 8px; border-bottom: 1px solid #9d865440; }
#hud .trade-side h3 { margin: 0; font-size: 16px; }
#hud .trade-acceptance { font-size: 11px; }
#hud .trade-items { min-height: 95px; max-height: 190px; overflow: auto; padding: 8px; display: grid; gap: 5px; align-content: start; }
#hud .trade-slot { display: flex; align-items: center; gap: 7px; padding: 6px; border: 1px solid #9b845334; background: #ede0c336; text-align: left; font-size: 12px; }
#hud .trade-slot .icon { width: 24px; height: 24px; flex-shrink: 0; }
#hud .trade-slot b { margin-left: auto; white-space: nowrap; }
#hud .trade-slot:disabled { opacity: 1; cursor: default; }
#hud .trade-gold { display: flex; align-items: center; gap: 7px; padding: 12px; border-top: 1px solid #9d865440; background: #c6a95425; }
#hud .trade-gold .icon { width: 22px; height: 22px; }
#hud .trade-gold small { margin-left: auto; font-size: 10px; }
#hud .trade-empty { font-size: 12px; font-style: italic; text-align: center; padding: 18px 0; }
#hud .trade-satchel { margin-top: 15px; }
#hud .trade-satchel-heading { display: flex; justify-content: space-between; align-items: center; font-size: 12px; }
#hud .trade-satchel h3 { font-size: 15px; margin: 0; }
#hud .trade-panel input { border: 1px solid #9d805450; color: #483824; background: #f8ebd060; padding: 6px; width: 100px; font: 13px Georgia, serif; }
#hud #trade-quantity { width: 70px; }
#hud .trade-picker { display: grid; grid-template-columns: repeat(10, 1fr); gap: 5px; margin: 10px 0; }
#hud .trade-picker button { position: relative; aspect-ratio: 1.1; border: 1px solid #9e805150; background: #ecdbb640; padding: 8px; }
#hud .trade-picker .icon { width: 27px; height: 27px; }
#hud .trade-picker small { position: absolute; right: 3px; bottom: 2px; font-size: 10px; }
#hud .trade-gold-editor { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-size: 12px; }
#hud .trade-gold-editor button, #hud .trade-actions > button { border: 1px solid #95744480; padding: 9px 14px; background: #f1e4c440; }
#hud .trade-feedback { margin: 14px 0; min-height: 16px; font-size: 12px; }
#hud .trade-actions { display: flex; justify-content: flex-end; gap: 10px; }
#hud .trade-actions .primary-button { margin: 0; width: auto; background: #8b97653a; }
#hud .trade-review-note { margin: 15px 0; }
[hidden] { display: none !important; }
@media(max-width: 700px) { #hud .trade-columns { gap: 8px; } #hud .trade-picker { grid-template-columns: repeat(7, 1fr); } #hud .dialogue-thread span { display: none; } #hud .trade-gold small { display: none; } }

/* Enter can open speech without expanding the Chronicle or closing a panel. */
#hud .chat-composer.quick-talk { position:fixed;z-index:110;left:50%;bottom:24px;transform:translateX(-50%);width:min(420px,calc(100vw - 28px));box-sizing:border-box;pointer-events:auto;padding:12px 14px;border:3px double #9e8252;border-radius:5px;background:#eee0c4fa;box-shadow:0 8px 28px #17241c55; }
#hud .quick-talk .chat-connection { display:none; }
#hud .quick-talk .chat-input-row input { padding:11px;font-size:14px; }
#hud .quick-talk .chat-input-hint { margin-top:8px; }
