.royal-messenger[hidden], .royal-news-panel[hidden], .royal-news-dot[hidden],
[data-messenger-kind][hidden] { display: none !important; }

.royal-messenger {
  position: fixed;
  inset: var(--messenger-top, 6rem) max(0.8rem, env(safe-area-inset-right)) auto auto;
  z-index: 79;
  width: min(25rem, calc(100vw - 1.6rem));
  overflow: hidden;
  color: #fff1d0;
  background: radial-gradient(ellipse at 0 0, #422256 0%, #1c1125 58%, #120d19 100%);
  border: 1px solid #b28645;
  border-radius: .55rem;
  box-shadow: 0 .55rem 1.4rem #0009;
}
.royal-messenger-head, .royal-news-head {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .35rem .55rem .35rem .8rem;
}
.royal-messenger-head strong {
  flex: 1;
  font: bold .95rem Georgia, serif;
  color: #f3d58e;
}
.royal-messenger-head .royal-link { min-height: 30px; padding: .32rem .55rem; font-size: .72rem; }
.royal-float-close {
  background: #1b0e23;
  color: #fff1d0;
  border: 1px solid #bb975965;
  border-radius: 50%;
  cursor: pointer;
  width: 2rem;
  height: 2rem;
  flex: 0 0 2rem;
  font-size: 1.18rem;
  line-height: 1;
}
.royal-float-close:focus-visible, .royal-news-seal:focus-visible {
  outline: 2px solid #ffe39a;
  outline-offset: 3px;
}
.royal-messenger-ticker {
  overflow: hidden;
  padding: .4rem .75rem .55rem;
  border-top: 1px solid #b2864550;
  font-size: .84rem;
}
.royal-messenger-ticker > div { width: max-content; white-space: nowrap; }
.messenger-static .royal-messenger-ticker > div { width: auto; white-space: normal; }
.royal-float-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}
.royal-news-dock {
  position: fixed;
  z-index: 78;
  inset: auto auto calc(var(--royal-float-bottom, 90px) + env(safe-area-inset-bottom)) max(.65rem, env(safe-area-inset-left));
}
.royal-news-seal {
  position: relative;
  display: grid;
  place-items: center;
  border: 1px solid #d5ab60;
  border-radius: 50%;
  background: radial-gradient(#46265a, #17101e 70%);
  box-shadow: 0 3px 15px #0009, inset 0 0 0 3px #201129;
  width: 46px;
  height: 46px;
  padding: 5px;
  cursor: pointer;
}
.royal-news-seal:hover { border-color: #ffe2a0; }
.royal-news-seal img { width: 100%; height: 100%; object-fit: contain; border-radius: 50%; }
.royal-news-dot {
  position: absolute;
  inset: 2px 1px auto auto;
  width: .55rem;
  height: .55rem;
  background: #ffd68c;
  border-radius: 50%;
  box-shadow: 0 0 .5rem #ffd68c;
}
.royal-news-panel {
  position: absolute;
  inset: auto auto calc(100% + .5rem) 0;
  width: min(25rem, calc(100vw - 1.3rem));
  max-height: min(57vh, 28rem);
  display: flex;
  flex-direction: column;
  color: #fff1d0;
  background: linear-gradient(145deg, #2e193b, #151019 62%);
  border: 1px solid #bd9855;
  box-shadow: 0 .65rem 1.75rem #000b;
  border-radius: .55rem;
  overflow: hidden;
}
.royal-news-head { border-bottom: 1px solid #b2864560; }
.royal-news-head h2 {
  flex: 1;
  font-size: 1.1rem;
  margin: 0;
  color: #f3d58e;
}
.royal-news-content { overflow: auto; padding: .65rem .8rem; overscroll-behavior: contain; }
.royal-news-entry { display: flex; gap: .65rem; padding: .6rem 0; border-bottom: 1px solid #bd98554a; }
.royal-news-entry:last-child { border-bottom: 0; }
.royal-news-entry img { width: 4rem; height: 4rem; border-radius: .25rem; object-fit: cover; }
.royal-news-entry time { color: #dabd86; font-size: .72rem; }
.royal-news-entry h3 { font-size: 1rem; margin: .14rem 0 .24rem; }
.royal-news-entry p { font-size: .86rem; margin: 0 0 .4rem; overflow-wrap: anywhere; }
.royal-message-event img { display: block; max-width: 100%; max-height: 45vh; margin-inline: auto; object-fit: contain; }
.royal-message-event p { white-space: pre-wrap; }

@media (max-width: 620px) {
  .royal-news-panel { width: min(21rem, calc(100vw - 1.3rem)); max-height: 41vh; }
  .royal-news-dock { --royal-float-bottom: 82px; }
}
@media (prefers-reduced-motion: reduce) {
  .royal-messenger-ticker > div { transform: none !important; width: auto; white-space: normal; }
}
@media (max-width: 620px) {
  body:has(#chatWindow:not([hidden])) .royal-news-panel {
    bottom: calc(100% + 29dvh + 1.5rem);
    max-height: min(20dvh, calc(100dvh - 160px - 29dvh - var(--royal-dock-clearance, 0px) - var(--royal-details-clearance, 0px)));
  }
}
body:has(.royal-gate) .royal-news-dock,
body:has(.royal-gate) .royal-messenger { visibility: hidden; }
