.luca-buddy[hidden], .luca-buddy [hidden] { display: none !important; }
.luca-buddy { position: fixed; z-index: 80; right: 1.25rem; bottom: 0; width: min(41rem, calc(100vw - 2.5rem)); min-height: min(20rem, 100dvh); max-height: 100dvh; display: flex; align-items: start; padding-left: 0; padding-right: 47%; pointer-events: none; }
.luca-buddy { padding-right: min(19.25rem, 43vw); }
/* Crop inside the solid lower edge and overlap the viewport by one pixel to prevent a composited seam. Mirror only the square avatar. */
.luca-buddy-figure { position: absolute; bottom: -1px; right: 0; left: auto; width: 44%; aspect-ratio: 1254 / 1214; overflow: hidden; pointer-events: none; }
.luca-buddy-figure img, .luca-buddy-figure canvas { display: block; width: 100%; height: auto; aspect-ratio: 1; object-fit: contain; transform: scaleX(-1); }
.luca-buddy-speech { position: relative; width: 100%; min-width: 0; margin-bottom: 5rem; padding: 1.35rem 1.25rem 1rem; background: #fff; color: #302d2d; border: 2px solid #e49696; border-radius: 1.5rem; box-shadow: 0 .3rem 1.2rem rgb(48 45 45 / 10%); pointer-events: auto; }
.luca-buddy-speech { display: flex; flex-direction: column; min-height: 0; max-height: calc(100dvh - 5rem); }
.luca-buddy-speech > [aria-live] { min-height: 0; overflow-y: auto; }
.luca-buddy-speech::before { content: ""; position: absolute; right: -1.1rem; left: auto; top: 42%; width: 1.7rem; height: 1.35rem; background: #fff; border-right: 2px solid #e49696; border-bottom: 2px solid #e49696; border-bottom-right-radius: .55rem; transform: skew(30deg) rotate(-20deg); }
.luca-buddy-speech h2 { color: #a55959; font-size: 1.15rem; font-weight: 600; margin: 0 1.8rem .6rem 0; }
.luca-buddy-speech p { margin: 0; color: #302d2d; overflow-wrap: anywhere; }
.luca-buddy-speech #luca-buddy-text { white-space: pre-wrap; line-height: 1.5; }
.luca-buddy-close { position: absolute; top: .35rem; right: .35rem; display: grid; place-items: center; width: 2.5rem; height: 2.5rem; padding: 0; border: 0; border-radius: 50%; background: #fff; color: #302d2d; font: 400 1.55rem/1 var(--font-ui); cursor: pointer; }
.luca-buddy-close:focus-visible { outline: 2px solid #8f4f55; outline-offset: 3px; }
.luca-buddy-actions { flex-shrink: 0; display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; }
.luca-buddy-actions .button { min-height: 2.6rem; }
.luca-updates-list { display: grid; gap: 1rem; margin-top: 1.5rem; }
.luca-update-card { padding: 1.25rem; margin-top: 0; overflow-wrap: anywhere; }
.luca-update-card h3 { margin: 0; font-weight: 500; }
.luca-update-body { white-space: pre-wrap; line-height: 1.6; }
.luca-update-form, .luca-admin-updates-list { padding: 1.25rem; }
.luca-update-form { display: grid; gap: 1rem; }
.luca-update-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.luca-update-form fieldset { min-width: 0; border: 1px solid var(--line); border-radius: var(--ui-radius); padding: .75rem; }
.luca-recipient-list { display: grid; gap: .5rem; max-height: 18rem; overflow-y: auto; }
.luca-recipient, .luca-checkbox { display: flex; align-items: center; gap: .65rem; }
.luca-recipient input, .luca-checkbox input { flex: 0 0 auto; width: auto; margin: 0; }
.luca-admin-update { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .75rem; padding: 1rem 0; border-bottom: 1px solid var(--line); }
.luca-admin-update:first-child { padding-top: 0; }
.luca-admin-update:last-child { border-bottom: 0; }
.luca-admin-update p { margin: .3rem 0 0; }
.luca-preferences-form { display: grid; gap: 1rem; }
#luca-update-editor > summary, #luca-update-management > summary { padding: 1rem 1.25rem; }
@media (max-width: 600px) {
  .luca-buddy { width: min(25rem, calc(100vw - 1.5rem)); right: .75rem; bottom: 0; min-height: 0; padding: 0; display: grid; grid-template-rows: minmax(0, 1fr) auto; max-height: calc(100dvh - .75rem); overflow: visible; }
  .luca-buddy-figure { position: relative; grid-row: 2; width: 42%; max-width: 10rem; justify-self: end; margin-top: 2rem; }
  .luca-buddy-speech { grid-row: 1; align-self: stretch; max-height: none; margin: 0 1.25rem 0 0; width: calc(100% - 1.25rem); }
  .luca-buddy-speech::before { right: 2rem; left: auto; top: calc(100% - .1rem); width: 1.4rem; height: 1.5rem; transform: skew(20deg) rotate(32deg); border-right: 2px solid #e49696; border-left: 0; border-top: 0; border-bottom: 2px solid #e49696; }
  .luca-update-fields { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 600px) and (max-height: 450px) {
  .luca-buddy-figure { width: 24%; max-width: 5.5rem; }
}
@media (prefers-reduced-motion: reduce) {
  .luca-buddy { scroll-behavior: auto; }
}
