.heygen-model-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 8px;
  border-radius: 22px;
  background: #eef3f8;
}

.heygen-model-grid button {
  display: grid;
  min-height: 96px;
  align-content: center;
  padding: 0 28px;
  border-radius: 16px;
  background: transparent;
  color: #64748b;
  text-align: left;
}

.heygen-model-grid button.active {
  background: #fff;
  color: #0f172a;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.08);
}

.heygen-model-grid span {
  font-size: 16px;
  font-weight: 900;
  line-height: 1.1;
}

.heygen-model-grid small {
  margin-top: 7px;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.15;
}

.model-warning {
  padding: 18px 24px;
  border-radius: 20px;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.35;
}

.model-warning.amber {
  border: 1px solid #fde68a;
  background: #fffbeb;
  color: #92400e;
}

.model-warning.blue {
  border: 1px solid #bae6fd;
  background: #f0f9ff;
  color: #075985;
}

.avatar-gallery {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.avatar-gallery .empty-box {
  grid-column: 1 / -1;
}

.avatar-tile {
  position: relative;
  overflow: hidden;
  border: 2px solid #e2e8f0;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.avatar-tile.active {
  border-color: #24a1de;
  box-shadow: 0 0 0 4px rgba(36, 161, 222, 0.22), 0 14px 30px rgba(15, 23, 42, 0.16);
}

.avatar-tile.active::before {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #24a1de;
  color: #fff;
  content: "✓";
  font-size: 16px;
  font-weight: 1000;
  box-shadow: 0 8px 18px rgba(36, 161, 222, 0.28);
}

.avatar-tile.saved {
  border-style: dashed;
}

.avatar-tile.disabled {
  opacity: 0.42;
  filter: grayscale(1);
}

.avatar-tile-preview {
  position: relative;
  aspect-ratio: 1.18;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(36, 161, 222, 0.10), rgba(16, 185, 129, 0.08)),
    #f8fafc;
}

.avatar-tile-media {
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 1;
  display: block;
}

.avatar-selected-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
}

.avatar-selected-badge {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 999px;
  background: #0f172a;
  color: #fff;
  font-size: 12px;
  font-weight: 900;
}

.avatar-selected-label {
  color: #0f172a;
  font-size: 12px;
  font-weight: 1000;
  text-transform: uppercase;
  letter-spacing: 0;
}

.avatar-selected-badge.shorts {
  background: #10b981;
}

.avatar-selected-badge.youtube {
  background: #0f172a;
}

.avatar-tile-body {
  display: grid;
  gap: 12px;
  padding: 12px;
}

.avatar-tile-info {
  min-width: 0;
  color: #0f172a;
}

.avatar-tile-info strong {
  display: block;
  font-size: 16px;
  font-weight: 900;
  line-height: 1.15;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.avatar-tile-info small {
  display: block;
  margin-top: 5px;
  color: #64748b;
  font-size: 12px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.avatar-model-lock {
  position: absolute;
  top: 8px;
  right: 8px;
  max-width: 124px;
  padding: 4px 6px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  text-align: center;
}

.avatar-tile-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.avatar-tile-actions button:only-child {
  grid-column: 1 / -1;
}

.avatar-tile-actions button {
  min-height: 42px;
  padding: 0 10px;
  border: 1px solid #cbd5e1;
  border-radius: 11px;
  background: #f8fafc;
  color: #475569;
  font-size: 13px;
  font-weight: 900;
  box-shadow: none;
}

.avatar-tile-actions button span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.avatar-tile-actions button.active.youtube {
  border-color: #0f172a;
  background: #0f172a;
  color: #fff;
}

.avatar-tile-actions button.active.shorts {
  border-color: #10b981;
  background: #10b981;
  color: white;
}

.avatar-tile-actions button:disabled {
  opacity: 0.5;
}

.avatar-placeholder {
  background: linear-gradient(135deg, #dbeafe, #f1f5f9);
  display: grid;
  place-items: center;
  color: #0f172a;
  font-size: 34px;
  font-weight: 1000;
}

.avatar-load-error {
  display: grid;
  gap: 10px;
  color: #475569;
}

.avatar-load-error strong {
  color: #0f172a;
}

.avatar-load-error button {
  justify-self: start;
}

.voice-compact {
  display: grid;
  gap: 8px;
}

.voice-compact label {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.voice-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.voice-row select {
  min-width: 0;
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
}

.voice-row button {
  min-height: 38px;
}

.voice-compact p {
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 620px) {
  .heygen-model-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
    padding: 5px;
    border-radius: 16px;
  }

  .heygen-model-grid button {
    min-height: 68px;
    padding: 0 9px;
    border-radius: 12px;
  }

  .heygen-model-grid span {
    font-size: 12px;
  }

  .heygen-model-grid small {
    font-size: 10px;
  }

  .avatar-target-row button,
  .voice-row select,
  .voice-row button {
    min-height: 44px;
  }

  .avatar-gallery {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .avatar-tile-info strong {
    font-size: 15px;
  }

  .avatar-tile-info small {
    font-size: 12px;
  }

  .avatar-selected-badge {
    min-height: 26px;
    font-size: 11px;
  }

  .avatar-tile-actions button {
    min-height: 42px;
    font-size: 13px;
  }

  .model-warning {
    padding: 12px 14px;
    border-radius: 14px;
    font-size: 13px;
  }

  .voice-row {
    grid-template-columns: 1fr;
  }
}
