:root {
  --skeleton-surface: #28222d;
  --skeleton-detail: #ffffff12;
  --skeleton-highlight: #e9c9f018;
  --skeleton-duration: 1.55s;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skeleton-block {
  position: relative;
  display: block;
  overflow: hidden;
  background: var(--skeleton-surface);
}

.chat-album-photo > .picture[data-image='loading'] { background: var(--skeleton-surface); }
.thread-page[data-appearance='light'] .thread-art { --skeleton-highlight: #41264418; }

.skeleton-block::after,
.skeleton-card::before,
:is(.chat-album-photo, .chat-art, .thread-art) > .picture[data-image='loading']::after {
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 24%, var(--skeleton-highlight) 50%, transparent 76%);
  content: '';
  pointer-events: none;
  transform: translateX(-100%);
  animation: skeleton-sweep var(--skeleton-duration) ease-in-out infinite;
}

@keyframes skeleton-sweep {
  75%, 100% { transform: translateX(100%); }
}

@media (prefers-reduced-motion: reduce) {
  .skeleton-block::after,
  .skeleton-card::before,
  :is(.chat-album-photo, .chat-art, .thread-art) > .picture[data-image='loading']::after { animation: none; }
}

.skeleton-lines { display: grid; gap: 7px; }
.skeleton-line { width: 100%; height: 8px; border-radius: 6px; }
.skeleton-line.short { width: 42%; }
.skeleton-line.medium { width: 70%; }
.skeleton-avatar { width: 100%; aspect-ratio: 1; border-radius: 50%; }
.skeleton-control { height: 44px; border-radius: 22px; }
.skeleton-card-art { position: absolute; inset: 0; }
.list-footer > .skeleton { width: 100%; }
.list-content:not(:empty) + .list-footer .skeleton-cards { margin-block-start: 2px; }
.skeleton-card::after, .skeleton-card .skeleton-block::after { display: none; }
.skeleton-card { background: var(--skeleton-surface); }
.discover-page .skeleton-card { background: var(--background); }
.discover-page .skeleton-card::before { display: none; }
.skeleton-card .skeleton-lines { gap: 0; }
.skeleton-card .skeleton-block { border-radius: 0; background: #ffffff1a; }
.skeleton-round-icon { width: 18px; height: 18px; }
.skeleton-round-value { width: 24px; height: 9px; }
.skeleton-card .skeleton-line { height: 9px; margin-block: 4.5px; }
.skeleton-card .skeleton-line.short { width: 60%; height: 12px; margin-block: 6px 10px; }
.skeleton-card .skeleton-line.medium { width: 80%; }
.skeleton-swipe .skeleton-line { background: var(--skeleton-detail); }
.skeleton-search-choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.skeleton-search-choices .skeleton-control { height: 36px; }

.skeleton.skeleton-swipe, .skeleton-swipe > .skeleton-art { display: flex; flex: 1; }
.skeleton-swipe .skeleton-lines { max-width: 340px; }

.skeleton-hero { position: relative; margin-bottom: 14px; }
.skeleton-hero-art { height: min(58vh, 440px); }
.skeleton-hero-copy {
  position: absolute;
  inset: auto 16px 14px;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  max-width: 280px;
}
.skeleton-hero-copy .skeleton-block { background: var(--skeleton-detail); }
.skeleton-media-tile { width: 100%; background: var(--background); }

.chat-loading-layout {
  --skeleton-surface: #ffffff0f;
  --skeleton-highlight: #ffffff12;
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  background: var(--background);
}
.chat-loading-layout .chat-header { background: transparent; }
.chat-loading-title { display: flex; align-items: center; gap: 8px; }
.chat-loading-avatar { width: 28px; height: 28px; flex: none; border-radius: 50%; }
.chat-loading-name { width: 104px; height: 14px; border-radius: 8px; }
.chat-loading-album, .chat-loading-mode { height: 30px; border-radius: 18px; }
.chat-loading-album { width: 46px; }
.chat-loading-mode { width: clamp(60px, 21vw, 88px); }
.chat-loading-settings { width: 24px; height: 24px; margin-inline: 2px 12px; border-radius: 50%; }
.chat-loading-transcript {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  gap: 30px;
  overflow: hidden;
  padding: 12px 16px 16px;
}
.guest-placeholder-transcript { padding-block-start: clamp(124px, 33vh, 328px); }
.chat-loading-message {
  flex: none;
  width: min(76%, 400px);
  padding: 20px;
  border: 1px solid #ffffff0b;
  border-radius: 16px;
  border-end-start-radius: 0;
}
.chat-loading-message.opening-placeholder { width: 100%; }
.chat-loading-message.outgoing-placeholder {
  align-self: end;
  width: min(53%, 270px);
  border-end-start-radius: 16px;
  border-end-end-radius: 0;
}
.chat-loading-message .skeleton-lines { gap: 12px; }
.chat-loading-message .skeleton-line { height: 9px; }
.chat-loading-dock::before { content: none; }
.chat-loading-dock > .chat-loading-composer {
  min-height: 56px;
  gap: 12px;
  padding-inline-end: 10px;
  background: transparent;
}
.chat-loading-input { width: min(48%, 180px); height: 12px; margin-inline-end: auto; border-radius: 8px; }
.chat-loading-inspiration { width: 24px; height: 24px; margin-inline: 12px; border-radius: 50%; }
.chat-loading-send { width: 48px; height: 36px; border-radius: 18px; }
.skeleton-product-icon {
  width: min(74px, 100%);
  aspect-ratio: 1;
  border-radius: 14px;
  background: var(--skeleton-detail);
}
.skeleton-store .skeleton-line { background: var(--skeleton-detail); }
.skeleton-onboarding .skeleton-control { margin-block: 12px; }

.skeleton-fields { display: grid; gap: 12px; }
.skeleton-rounded-row { min-height: 52px; border-radius: 12px; }
.skeleton-textarea { height: 135px; border-radius: 12px; }
.skeleton-chat-memory .skeleton-fields { gap: 20px; }
.skeleton-chat-memory .skeleton-textarea { height: 240px; }
.skeleton-chat-memory .skeleton-control { height: 52px; }
.skeleton-settings .chat-settings-group > .skeleton-lines { margin-block-end: 12px; }
.skeleton-settings-icon { width: 16px; height: 16px; flex: none; border-radius: 5px; }
.skeleton-feedback-email .skeleton-rounded-row { min-height: 44px; }
.skeleton-delete-confirm .skeleton-control { height: 52px; }
.skeleton-chat-history { margin-block: 8px; }
.skeleton-chat-roles { width: min(320px, calc(100% - 24px)); flex: none; }
.skeleton-chat-roles .skeleton-control { width: 100%; }
.skeleton-role-editor .chat-role-upload { justify-self: center; }
.skeleton-chat-background .chat-background-choices { margin-block-start: 12px; }
.skeleton-chat-background .chat-background-tile { height: 160px; flex: 0 0 120px; }
.skeleton-block:is(.chat-album-photo, .chat-gallery-photo, .chat-role-upload, .character-photo-control,
  .chat-background-hero, .chat-background-tile) { background: var(--skeleton-surface); }
