.hlc-root {
  position: fixed;
  z-index: 49;
  right: 12px;
  bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  display: flex;
  align-items: flex-end;
  gap: 8px;
  color: var(--ink, #ece6d8);
  font-family: "Manrope", system-ui, sans-serif;
  pointer-events: none;
}
.hlc-root[hidden], .hlc-panel[hidden], .hlc-restore[hidden] { display: none !important; }
.hlc-root *, .hlc-alarm * { box-sizing: border-box; }
.hlc-root > * { pointer-events: auto; }
.hlc-root button, .hlc-root input, .hlc-alarm button { font: inherit; }
.hlc-root button, .hlc-alarm button { color: inherit; }
.hlc-creature {
  width: 104px;
  height: 108px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  filter: drop-shadow(0 13px 16px rgba(0, 0, 0, .42));
  transition: transform .22s ease;
}
.hlc-creature:hover { transform: translateY(-3px); }
.hlc-creature:focus-visible, .hlc-icon-button:focus-visible, .hlc-tabs button:focus-visible,
.hlc-grid button:focus-visible, .hlc-primary:focus-visible, .hlc-danger:focus-visible,
.hlc-restore:focus-visible, .hlc-form input:focus-visible {
  outline: 2px solid var(--gold, #d8b04c);
  outline-offset: 3px;
}
.hlc-creature img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center bottom;
  user-select: none;
  animation: hlc-float 4.8s ease-in-out infinite;
}
.hlc-panel {
  width: min(350px, calc(100vw - 28px));
  max-height: min(600px, calc(100vh - 156px));
  max-height: min(600px, calc(100svh - 156px));
  overflow: hidden;
  border: 1px solid rgba(216, 176, 76, .28);
  border-color: color-mix(in srgb, var(--gold, #d8b04c) 28%, transparent);
  border-radius: 22px;
  background: linear-gradient(155deg, rgba(33, 24, 56, .985), rgba(10, 8, 18, .985));
  box-shadow: 0 24px 76px rgba(0, 0, 0, .6);
  -webkit-backdrop-filter: blur(24px);
  backdrop-filter: blur(24px);
  animation: hlc-in .24s ease-out;
}
[data-theme="light"] .hlc-panel {
  background: linear-gradient(155deg, rgba(255, 252, 255, .98), rgba(235, 224, 243, .98));
  box-shadow: 0 24px 68px rgba(55, 26, 75, .2);
}
.hlc-header { display: flex; align-items: flex-start; justify-content: space-between; padding: 18px 18px 10px; }
.hlc-header small, .hlc-alarm small { display: block; color: var(--gold, #d8b04c); font-size: 11px; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; }
.hlc-header h2, .hlc-alarm h2 { margin: 4px 0 0; font-family: var(--dispcyr, "Forum", serif); font-size: 28px; font-weight: 500; line-height: 1; }
.hlc-icon-button { display: inline-flex; width: 40px; height: 40px; align-items: center; justify-content: center; flex: 0 0 auto; border: 0; border-radius: 12px; background: transparent; color: var(--ink-dim, #b7a6cf) !important; cursor: pointer; }
.hlc-icon-button svg, .hlc-restore svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
/* Колонки раздаются по числу вкладок, а не жёстко по три. Раньше их было
   ровно три, а четвёртую — Офановы уведомления — добавляло правило с :has().
   Условие :has() знают Chromium 105 и Safari 15.4 и новее; на телефоне
   общины (Chromium 99) оно отбрасывается целиком, и четвёртая вкладка
   уезжала за край экрана. Авторазмётка обходится без него и понимается
   всеми браузерами с 2017 года. */
.hlc-tabs { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); padding: 0 12px; border-bottom: 1px solid var(--line, rgba(216, 176, 76, .16)); }
.hlc-tabs button { min-height: 44px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--ink-faint, #7a6f90); cursor: pointer; font-size: 13px; }
.hlc-tabs button.is-active { border-color: var(--gold, #d8b04c); color: var(--ink, #ece6d8); }
.hlc-content { max-height: min(465px, calc(100vh - 265px));
 max-height: min(465px, calc(100svh - 265px)); overflow: auto; padding: 16px; overscroll-behavior: contain; }
.hlc-speech { padding: 16px; border: 1px solid rgba(216, 176, 76, .16); border-radius: 15px; background: linear-gradient(135deg, rgba(216, 176, 76, .11), rgba(139, 92, 246, .08)); }
.hlc-speech small, .hlc-speech strong, .hlc-speech p { display: block; }
.hlc-speech small { color: var(--gold, #d8b04c); font-size: 12px; font-weight: 700; }
.hlc-speech strong { margin-top: 7px; font-family: var(--dispcyr, "Forum", serif); font-size: 20px; font-weight: 500; line-height: 1.2; }
.hlc-speech p { margin: 8px 0 0; color: var(--ink-dim, #b7a6cf); font-size: 13px; line-height: 1.45; }
.hlc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.hlc-grid button { min-height: 46px; padding: 8px; border: 1px solid var(--line, rgba(216, 176, 76, .16)); border-radius: 12px; background: rgba(255, 255, 255, .035); cursor: pointer; font-size: 14px; }
.hlc-list { display: grid; gap: 8px; }
.hlc-reminder { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px; border: 1px solid var(--line, rgba(216, 176, 76, .16)); border-radius: 12px; }
.hlc-reminder > span { min-width: 0; }
.hlc-reminder strong, .hlc-reminder small { display: block; overflow-wrap: anywhere; }
.hlc-reminder strong { font-size: 15px; font-weight: 600; }
.hlc-reminder small { margin-top: 4px; color: var(--ink-dim, #b7a6cf); font-size: 12px; }
.hlc-empty, .hlc-note { padding: 18px 6px; color: var(--ink-dim, #b7a6cf); text-align: center; font-size: 14px; line-height: 1.5; }
.hlc-form { display: grid; gap: 12px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line, rgba(216, 176, 76, .16)); }
.hlc-form label { display: grid; gap: 6px; color: var(--ink-dim, #b7a6cf); font-size: 13px; }
.hlc-form input { width: 100%; min-width: 0; height: 46px; padding: 0 12px; border: 1px solid var(--line, rgba(216, 176, 76, .16)); border-radius: 11px; background: rgba(255, 255, 255, .045); color: var(--ink, #ece6d8); color-scheme: dark; font-size: 16px; }
[data-theme="light"] .hlc-form input { color-scheme: light; }
.hlc-date-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.hlc-primary, .hlc-danger { width: 100%; min-height: 46px; padding: 10px 15px; border-radius: 12px; cursor: pointer; font-size: 15px; font-weight: 700; }
.hlc-primary { border: 1px solid rgba(216, 176, 76, .42); background: rgba(216, 176, 76, .15); color: var(--gold, #d8b04c) !important; }
.hlc-danger { border: 1px solid rgba(200, 93, 106, .28); background: rgba(200, 93, 106, .08); color: #dbaeb3 !important; }
.hlc-restore { position: fixed; z-index: 49; right: 14px; bottom: calc(82px + env(safe-area-inset-bottom, 0px)); display: inline-flex; width: 42px; height: 42px; align-items: center; justify-content: center; border: 1px solid rgba(216, 176, 76, .34); border-radius: 50%; background: var(--bar, rgba(8, 6, 15, .94)); color: var(--gold, #d8b04c); cursor: pointer; box-shadow: 0 10px 28px rgba(0, 0, 0, .35); }
.hlc-alarm { position: fixed; z-index: 65; right: 14px; top: calc(14px + env(safe-area-inset-top, 0px)); width: min(410px, calc(100vw - 28px)); display: grid; grid-template-columns: 76px 1fr; gap: 12px; padding: 17px; border: 1px solid rgba(216, 176, 76, .38); border-radius: 20px; background: linear-gradient(135deg, #281b39, #0b0913); color: #ece6d8; box-shadow: 0 24px 76px rgba(0, 0, 0, .64); }
.hlc-alarm img { width: 76px; height: 82px; object-fit: contain; }
.hlc-alarm p { margin: 8px 0 0; color: #c7bad2; font-size: 15px; line-height: 1.35; overflow-wrap: anywhere; }
.hlc-alarm > button { grid-column: 1 / -1; }
[dir="rtl"] .hlc-header, [dir="rtl"] .hlc-speech, [dir="rtl"] .hlc-form, [dir="rtl"] .hlc-reminder, [dir="rtl"] .hlc-alarm { text-align: right; }
@keyframes hlc-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@keyframes hlc-in { from { opacity: 0; transform: translateY(7px) scale(.985); } }
@media (max-width: 700px) {
  .hlc-root { right: 4px; bottom: calc(62px + env(safe-area-inset-bottom, 0px)); }
  .hlc-root.is-room { left: 5px; right: auto; bottom: calc(74px + env(safe-area-inset-bottom, 0px)); }
  .hlc-creature { width: 88px; height: 92px; }
  .hlc-panel { position: fixed; left:10px;right:10px; bottom: calc(150px + env(safe-area-inset-bottom, 0px)); width: auto; max-height: calc(100vh - 178px - env(safe-area-inset-top, 0px));
 max-height: calc(100svh - 178px - env(safe-area-inset-top, 0px)); }
  .hlc-content { max-height: calc(100vh - 286px - env(safe-area-inset-top, 0px));
 max-height: calc(100svh - 286px - env(safe-area-inset-top, 0px)); }
  .hlc-date-fields { grid-template-columns: 1fr; }
  .hlc-speech strong { font-size: 21px; }
  .hlc-speech p, .hlc-grid button, .hlc-empty, .hlc-note, .hlc-reminder strong, .hlc-primary, .hlc-danger { font-size: 16px; }
  .hlc-form label { font-size: 15px; }
}
@media (min-width: 1080px) {
  .hlc-root { right: 22px; bottom: 22px; }
  .hlc-restore { right: 24px; bottom: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  .hlc-root *, .hlc-alarm * { animation: none !important; transition-duration: .01ms !important; }
}

/* Офан у правого края: написано физически, а не логическим свойством.
   inset-inline-end знают только Safari 14.1 и Chromium 87 и новее. На старом
   телефоне строка просто выбрасывается — и Офан остаётся там, где его
   поставил поток, то есть у левого края. Ровно это и есть жалоба про лапку.
   Для иврита разворачиваем явно, повторяя ту же лесенку размеров экрана. */
[dir="rtl"] .hlc-root { right: auto; left: 12px; }
[dir="rtl"] .hlc-restore { right: auto; left: 14px; }
[dir="rtl"] .hlc-alarm { right: auto; left: 14px; }
@media (max-width: 700px) {
  [dir="rtl"] .hlc-root { right: auto; left: 4px; }
  [dir="rtl"] .hlc-root.is-room { left: auto; right: 5px; }
}
@media (min-width: 1080px) {
  [dir="rtl"] .hlc-root { right: auto; left: 22px; }
  [dir="rtl"] .hlc-restore { right: auto; left: 24px; }
}
